PatchworkOS
Loading...
Searching...
No Matches
mutex.h File Reference
#include <kernel/sched/wait.h>
#include <kernel/sync/lock.h>
#include <stdbool.h>

Go to the source code of this file.

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   {.waitQueue = WAIT_QUEUE_CREATE, .owner = NULL, .depth = 0, .lock = LOCK_CREATE}
 Create a mutex initializer.
 

Typedefs

typedef struct thread thread_t
 

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)
 

Typedef Documentation

◆ thread_t

typedef struct thread thread_t

Definition at line 8 of file mutex.h.