diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/host/task.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/host/task.c b/core/host/task.c index 500e18413d..870f8c3dc3 100644 --- a/core/host/task.c +++ b/core/host/task.c @@ -183,7 +183,7 @@ pthread_t task_get_thread(task_id_t tskid) uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait) { - tasks[tskid].event = event; + atomic_or(&tasks[tskid].event, event); if (wait) return task_wait_event(-1); return 0; @@ -202,8 +202,7 @@ uint32_t task_wait_event(int timeout_us) pthread_cond_wait(&tasks[tid].resume, &run_lock); /* Resume */ - ret = tasks[tid].event; - tasks[tid].event = 0; + ret = atomic_read_clear(&tasks[tid].event); pthread_mutex_unlock(&interrupt_lock); return ret; } @@ -231,7 +230,8 @@ uint32_t task_wait_event_mask(uint32_t event_mask, int timeout_us) /* Re-post any other events collected */ if (events & ~event_mask) - tasks[task_get_current()].event |= events & ~event_mask; + atomic_or(&tasks[task_get_current()].event, + events & ~event_mask); return events & event_mask; } |