|
PatchworkOS
da8a090
A non-POSIX operating system.
|
Ticket spinlock. More...
Ticket spinlock.
Data Structures | |
| struct | lock_t |
| A simple ticket lock implementation. More... | |
Macros | |
| #define | LOCK_DEADLOCK_ITERATIONS 10000000 |
| Number of iterations before we consider a deadlock to have occurred in lock_acquire. This is only used in debug builds. | |
| #define | LOCK_CANARY 0xDEADBEEF |
| Lock canary value to detect memory corruption. | |
| #define | LOCK_SCOPE(lock) |
| Acquires a lock for the reminder of the current scope. | |
| #define | LOCK_CREATE() |
| Create a lock initializer. | |
Functions | |
| static void | lock_init (lock_t *lock) |
| Initializes a lock. | |
| static void | lock_acquire (lock_t *lock) |
| Acquires a lock, blocking until it is available. | |
| static void | lock_release (lock_t *lock) |
| Releases a lock. | |
| static void | lock_cleanup (lock_t **lock) |
| #define LOCK_DEADLOCK_ITERATIONS 10000000 |
| #define LOCK_CANARY 0xDEADBEEF |
| #define LOCK_SCOPE | ( | lock | ) |
Acquires a lock for the reminder of the current scope.
| lock | Pointer to the lock to acquire. |
| #define LOCK_CREATE | ( | ) |
|
inlinestatic |
|
inlinestatic |
Acquires a lock, blocking until it is available.
This function disables interrupts on the current CPU. It is not recursive, and attempting to acquire a lock that is already held by the same CPU will result in a deadlock.
| lock | Pointer to the lock to acquire. |
Definition at line 103 of file lock.h.
|
inlinestatic |