[Cbe-oss-dev] [PATCH 19/22]MARS/task: event flag try wait return bits
Yuji Mano
yuji.mano at am.sony.com
Fri Mar 20 07:54:50 EST 2009
This fixes the task event flag implementation so that the current bits status is
properly returned when try_wait returns MARS_ERROR_BUSY.
Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
---
task/src/host/lib/task_event_flag.c | 8 ++++++++
task/src/mpu/lib/task_event_flag.c | 5 +++++
2 files changed, 13 insertions(+)
--- a/task/src/host/lib/task_event_flag.c
+++ b/task/src/host/lib/task_event_flag.c
@@ -265,6 +265,10 @@ static int wait(uint64_t event_flag_ea,
switch (mask_mode) {
case MARS_TASK_EVENT_FLAG_MASK_OR:
while ((event_flag->bits & mask) == 0) {
+ /* get current bits status if return bits requested */
+ if (bits)
+ *bits = event_flag->bits;
+
mars_mutex_unlock_put(event_flag_ea,
(struct mars_mutex *)event_flag);
@@ -283,6 +287,10 @@ static int wait(uint64_t event_flag_ea,
break;
case MARS_TASK_EVENT_FLAG_MASK_AND:
while ((event_flag->bits & mask) != mask) {
+ /* get current bits status if return bits requested */
+ if (bits)
+ *bits = event_flag->bits;
+
mars_mutex_unlock_put(event_flag_ea,
(struct mars_mutex *)event_flag);
--- a/task/src/mpu/lib/task_event_flag.c
+++ b/task/src/mpu/lib/task_event_flag.c
@@ -185,8 +185,13 @@ static int wait(uint64_t event_flag_ea,u
if (wait) {
/* only try so return busy */
if (try) {
+ /* get current bits status if return bits requested */
+ if (bits)
+ *bits = event_flag.bits;
+
mars_mutex_unlock_put(event_flag_ea,
(struct mars_mutex *)&event_flag);
+
return MARS_ERROR_BUSY;
}
More information about the cbe-oss-dev
mailing list