diff options
author | Yuji Mano <yuji.mano@am.sony.com> | 2009-03-19 13:54:50 -0700 |
---|---|---|
committer | Yuji Mano <yuji.mano@am.sony.com> | 2009-03-23 12:21:06 -0700 |
commit | 10f5ea124799f51c0e37aff2edc5045d2e5d64f6 (patch) | |
tree | 2a36943b7bf4b023b8a8d51b7d20a1a35c2d8461 | |
parent | c5fcfc5ee25f24e8ec071e2e9a0907ec9cfd0730 (diff) | |
download | mars-src-10f5ea124799f51c0e37aff2edc5045d2e5d64f6.tar.gz |
task: Event flag try wait return bits
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@am.sony.com>
Acked-by: Kazunori Asayama <asayama@sm.sony.co.jp>
-rw-r--r-- | task/src/host/lib/task_event_flag.c | 8 | ||||
-rw-r--r-- | task/src/mpu/lib/task_event_flag.c | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/task/src/host/lib/task_event_flag.c b/task/src/host/lib/task_event_flag.c index 728bcda..cfae340 100644 --- 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); diff --git a/task/src/mpu/lib/task_event_flag.c b/task/src/mpu/lib/task_event_flag.c index 1de2675..2a004f2 100644 --- 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,uint32_t mask, uint8_t mask_mode, 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; } |