summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/cortex-m/task.c3
-rw-r--r--core/cortex-m0/task.c2
-rw-r--r--core/host/task.c3
-rw-r--r--core/nds32/task.c2
4 files changed, 9 insertions, 1 deletions
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c
index de690ad007..7f667b3f4a 100644
--- a/core/cortex-m/task.c
+++ b/core/cortex-m/task.c
@@ -481,7 +481,8 @@ void mutex_lock(struct mutex *mtx)
* 2 if somebody else owns the mutex, 0 else.
*/
if (value == 2)
- task_wait_event(0); /* Contention on the mutex */
+ /* Contention on the mutex */
+ task_wait_event_mask(TASK_EVENT_MUTEX, 0);
} while (value);
atomic_clear(&mtx->waiters, id);
diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c
index b30cab5c98..af3a4e2277 100644
--- a/core/cortex-m0/task.c
+++ b/core/cortex-m0/task.c
@@ -451,6 +451,8 @@ void mutex_lock(struct mutex *mtx)
if (mtx->lock == 0)
break;
__asm__ __volatile__("cpsie i");
+ /* TODO(crbug.com/435612, crbug.com/435611)
+ * This discards any pending events! */
task_wait_event(0); /* Contention on the mutex */
}
mtx->lock = 2;
diff --git a/core/host/task.c b/core/host/task.c
index 5bff856def..98a77b8e41 100644
--- a/core/host/task.c
+++ b/core/host/task.c
@@ -210,6 +210,9 @@ void mutex_lock(struct mutex *mtx)
}
if (!value)
+ /* Contention on the mutex */
+ /* TODO(crbug.com/435612, crbug.com/435611)
+ * This discards any pending events! */
task_wait_event(-1);
} while (!value);
diff --git a/core/nds32/task.c b/core/nds32/task.c
index fc167da878..1725f2b498 100644
--- a/core/nds32/task.c
+++ b/core/nds32/task.c
@@ -381,6 +381,8 @@ void mutex_lock(struct mutex *mtx)
/* end of critical section : re-enable interrupts */
asm volatile ("setgie.e");
/* Sleep waiting for our turn */
+ /* TODO(crbug.com/435612, crbug.com/435611)
+ * This discards any pending events! */
task_wait_event(0);
/* re-enter critical section */
asm volatile ("setgie.d ; dsb");