44 #define SEMA_CREATE(value) { (value), SEMA_OK, MUTEX_INIT } 50 #define SEMA_CREATE_LOCKED() { (0), SEMA_OK, MUTEX_INIT_LOCKED } 148 return _sema_wait(sema, (timeout != 0), timeout);
static int sema_try_wait(sema_t *sema)
Test if the semaphore is posted.
mutex_t mutex
mutex of the semaphore
sema_state_t state
state of the semaphore
unsigned int value
value of the semaphore
static int sema_wait(sema_t *sema)
Wait for a semaphore being posted (without timeout).
sema_state_t
A Semaphore states.
void sema_destroy(sema_t *sema)
Destroys a semaphore.
static int sema_wait_timed(sema_t *sema, uint64_t timeout)
Wait for a semaphore being posted.
static unsigned sema_get_value(const sema_t *sema)
Get a semaphore's current value.
Mutex for thread synchronization.
int sema_post(sema_t *sema)
Signal semaphore.
void sema_create(sema_t *sema, unsigned int value)
Creates semaphore dynamically.
int _sema_wait(sema_t *sema, int block, uint64_t timeout)
Wait for a semaphore, blocking or non-blocking.