-
Notifications
You must be signed in to change notification settings - Fork 2.1k
core: mutex_t::val could memorize holding thread id, not a boolean #4494
Copy link
Copy link
Closed
Labels
Area: coreArea: RIOT kernel. Handle PRs marked with this with care!Area: RIOT kernel. Handle PRs marked with this with care!Discussion: RFCThe issue/PR is used as a discussion starting point about the item of the issue/PRThe issue/PR is used as a discussion starting point about the item of the issue/PR
Description
For debugging purposes it would be nice if mutex_t::val stored the current thread id, not a boolean. The test if the mutex is held would remain the same: mutex_t::val == 0 → mutex_t::val == KERNEL_PID_UNDEF (KERNEL_PID_UNDEF == 0), so I see no extra overhead. The locking would be no more difficult either: atomic_set_to_one(&mutex.val)(which uses atomic_cas) → atomic_cas(&mutex.val, KERNEL_PID_UNDEF, sched_active_pid).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area: coreArea: RIOT kernel. Handle PRs marked with this with care!Area: RIOT kernel. Handle PRs marked with this with care!Discussion: RFCThe issue/PR is used as a discussion starting point about the item of the issue/PRThe issue/PR is used as a discussion starting point about the item of the issue/PR