Skip to content

xtimer: infinite loop with xtimer_mutex_lock_timeout  #6427

@vincent-d

Description

@vincent-d

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();
}

Metadata

Metadata

Labels

Area: timersArea: timer subsystemsType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions