|
PatchworkOS
|
A simple ticket lock implementation. More...
#include <lock.h>
Data Fields | |
| atomic_uint16_t | nextTicket |
| atomic_uint16_t | nowServing |
| uint32_t | canary |
| uintptr_t | calledFrom |
A simple ticket lock implementation.
This lock disables interrupts when acquired, and restores the interrupt state when released. It is not recursive, and attempting to acquire a lock that is already held by the same CPU will result in a deadlock.
In debug builds, the lock contains a canary value to detect memory corruption and a deadlock detection mechanism that will panic if a deadlock is detected.