1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

core/mutex: Add assert guard against usage without threads

This commit is contained in:
chrysn 2021-02-15 06:01:01 +01:00
parent bf7c697c8d
commit 6145949f88

View File

@ -49,7 +49,9 @@ static inline __attribute__((always_inline)) void _block(mutex_t *mutex,
unsigned irq_state)
{
thread_t *me = thread_get_active();
/* Fail visibly even if a blocking action is called from somewhere where
* it's subtly not allowed, eg. board_init */
assert(me != NULL);
DEBUG("PID[%" PRIkernel_pid "] mutex_lock() Adding node to mutex queue: "
"prio: %" PRIu32 "\n", thread_getpid(), (uint32_t)me->priority);
sched_set_status(me, STATUS_MUTEX_BLOCKED);