-
Notifications
You must be signed in to change notification settings - Fork 2.1k
xtimer: infinite loop with xtimer_mutex_lock_timeout #6427
Copy link
Copy link
Closed
Labels
Area: timersArea: timer subsystemsArea: timer subsystemsType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)
Description
Hi,
I tried to use xtimer_mutex_lock_timeout but if I try to lock the mutex again when the timeout has expired, the mutex_lock is stuck in an infinite loop.
By changing the _mutex_timeout function as follow, it solves the issue:
static void _mutex_timeout(void *arg)
{
mutex_thread_t *mt = (mutex_thread_t *)arg;
mt->timeout = 1;
list_remove(&mt->mutex->queue, (list_node_t *)&mt->thread->rq_entry);
if (mt->mutex->queue.next == NULL) {
mt->mutex->queue.next = MUTEX_LOCKED;
}
sched_set_status(mt->thread, STATUS_PENDING);
thread_yield_higher();
}Reactions are currently unavailable
Metadata
Metadata
Labels
Area: timersArea: timer subsystemsArea: timer subsystemsType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)The issue reports a bug / The PR fixes a bug (including spelling errors)