PebbleOS
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
mutex.h File Reference
#include <pbl/kernel/types.h>
#include <pbl/kernel/compiler.h>

Data Structures

struct  pbl_mutex
 Recursive mutex. More...
 

Macros

#define PBL_MUTEX_INITIALIZER   {.owner = NULL, .count = 0, .lock_lr = 0}
 Static initializer for an unlocked mutex.
 
#define PBL_MUTEX_DEFINE(name)   struct pbl_mutex name = PBL_MUTEX_INITIALIZER
 Define an unlocked mutex, usable without pbl_mutex_init().
 

Functions

void pbl_mutex_init (struct pbl_mutex *m)
 Initialize a mutex in dynamically allocated memory.
 
void pbl_mutex_deinit (struct pbl_mutex *m)
 Release a mutex before its memory is reused.
 
int pbl_mutex_lock_lr (struct pbl_mutex *m, pbl_timeout_t timeout, uintptr_t lr)
 Lock a mutex, recording a given lock site.
 
static int pbl_mutex_lock (struct pbl_mutex *m, pbl_timeout_t timeout)
 Lock a mutex.
 
void pbl_mutex_unlock (struct pbl_mutex *m)
 Undo one lock of a mutex.
 
bool pbl_mutex_is_owner (const struct pbl_mutex *m)
 Check whether the calling thread owns a mutex.
 
void pbl_mutex_assert_held (const struct pbl_mutex *m, bool held)
 Assert that ownership of a mutex by the calling thread matches held.