diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/cortex-m/task.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c index 75fbf99155..61697d2684 100644 --- a/core/cortex-m/task.c +++ b/core/cortex-m/task.c @@ -860,7 +860,13 @@ void mutex_lock(struct mutex *mtx) uint32_t value; uint32_t id = 1 << task_get_current(); - ASSERT(id != TASK_ID_INVALID); + /* + * mutex_lock() must not be used in interrupt context (because we wait + * if there is contention). Task ID is not valid before task_start() + * (since current_task is scratchpad). + */ + ASSERT(!in_interrupt_context() && task_start_called()); + atomic_or(&mtx->waiters, id); do { |