Mutex for thread synchronization. More...
#include <stddef.h>#include <stdint.h>#include <stdbool.h>#include "architecture.h"#include "kernel_defines.h"#include "list.h"#include "thread.h"
Include dependency graph for mutex.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | mutex_t |
| Mutex structure. More... | |
| struct | mutex_cancel_t |
| A cancellation structure for use with mutex_lock_cancelable and mutex_cancel. More... | |
Macros | |
| #define | MUTEX_INIT { .queue = { .next = NULL } } |
| Static initializer for mutex_t. More... | |
| #define | MUTEX_INIT_LOCKED { .queue = { .next = MUTEX_LOCKED } } |
| Static initializer for mutex_t with a locked mutex. | |
Functions | |
| bool | mutex_lock_internal (mutex_t *mutex, bool block) |
| Internal function implementing mutex_lock and mutex_trylock. More... | |
| static void | mutex_init (mutex_t *mutex) |
| Initializes a mutex object. More... | |
| static void | mutex_init_locked (mutex_t *mutex) |
| Initializes a mutex object in a locked state. More... | |
| static mutex_cancel_t | mutex_cancel_init (mutex_t *mutex) |
| Initialize a mutex cancellation structure. More... | |
| static int | mutex_trylock (mutex_t *mutex) |
| Tries to get a mutex, non-blocking. More... | |
| static void | mutex_lock (mutex_t *mutex) |
| Locks a mutex, blocking. More... | |
| int | mutex_lock_cancelable (mutex_cancel_t *mc) |
| Locks a mutex, blocking. More... | |
| void | mutex_unlock (mutex_t *mutex) |
| Unlocks the mutex. More... | |
| void | mutex_unlock_and_sleep (mutex_t *mutex) |
| Unlocks the mutex and sends the current thread to sleep. More... | |
| void | mutex_cancel (mutex_cancel_t *mc) |
| Cancels a call to mutex_lock_cancelable. More... | |