[Cbe-oss-dev] [PATCH 2/5] MARS: yield in task event flag wait busy loop
Yuji Mano
Yuji.Mano at am.sony.com
Tue Jul 15 10:26:32 EST 2008
Call sched_yield() inside the busy loop on the host-side
to wait for task event flag bits to be set. This allows
other processes to run more generously on the host while
waiting in the busy loop.
Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
---
src/host/lib/mars_task_event_flag.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/src/host/lib/mars_task_event_flag.c
+++ b/src/host/lib/mars_task_event_flag.c
@@ -35,6 +35,8 @@
* LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
*/
+#include <sched.h>
+
#include "mars/mars_task_event_flag.h"
#include "mars/mars_workload_queue.h"
#include "mars/mars.h"
@@ -173,14 +175,12 @@ int mars_task_event_flag_wait(struct mar
/* check condition based on wait mode */
switch (mask_mode) {
case MARS_TASK_EVENT_FLAG_MASK_OR:
- while ((*(volatile uint32_t *)
- &event_flag->bits | mask) == 0) {
- }
+ while ((event_flag->bits | mask) == 0)
+ sched_yield();
break;
case MARS_TASK_EVENT_FLAG_MASK_AND:
- while ((*(volatile uint32_t *)
- &event_flag->bits & mask) != mask) {
- }
+ while ((event_flag->bits & mask) != mask)
+ sched_yield();
break;
}
More information about the cbe-oss-dev
mailing list