|
PatchworkOS
966e257
A non-POSIX operating system.
|
Recursive Mutex. More...
Recursive Mutex.
Data Structures | |
| struct | mutex_t |
| Mutex structure. More... | |
Macros | |
| #define | MUTEX_SCOPE(mutex) |
| Acquires a mutex for the reminder of the current scope. | |
| #define | MUTEX_CREATE(name) {.waitQueue = WAIT_QUEUE_CREATE(name.waitQueue), .owner = NULL, .depth = 0, .lock = LOCK_CREATE()} |
| Create a mutex initializer. | |
Functions | |
| void | mutex_init (mutex_t *mtx) |
| Initializes a mutex. | |
| void | mutex_deinit (mutex_t *mtx) |
| Deinitializes a mutex. | |
| void | mutex_acquire (mutex_t *mtx) |
| Acquires a mutex, blocking until it is available. | |
| bool | mutex_acquire_timeout (mutex_t *mtx, clock_t timeout) |
| Acquires a mutex, blocking until it is available or the timeout is reached. | |
| void | mutex_release (mutex_t *mtx) |
| Releases a mutex. | |
| static void | mutex_cleanup (mutex_t **mtx) |
| #define MUTEX_SCOPE | ( | mutex | ) |
Acquires a mutex for the reminder of the current scope.
| mutex | Pointer to the mutex to acquire. |
| #define MUTEX_CREATE | ( | name | ) | {.waitQueue = WAIT_QUEUE_CREATE(name.waitQueue), .owner = NULL, .depth = 0, .lock = LOCK_CREATE()} |
| void mutex_init | ( | mutex_t * | mtx | ) |
| void mutex_deinit | ( | mutex_t * | mtx | ) |
| void mutex_acquire | ( | mutex_t * | mtx | ) |
Acquires a mutex, blocking until it is available.
If the mutex is already owned by the current thread, this function will return immediately.
| mtx | Pointer to the mutex to acquire. |
Definition at line 28 of file mutex.c.
Acquires a mutex, blocking until it is available or the timeout is reached.
If the mutex is already owned by the current thread, this function will return immediately.
| mtx | Pointer to the mutex to acquire. |
| timeout | Timeout in clock ticks or CLOCKS_NEVER to wait indefinitely. |
Definition at line 35 of file mutex.c.
| void mutex_release | ( | mutex_t * | mtx | ) |