33#if IS_USED(MODULE_SEMA_DEPRECATED)
49#define SEMA_CREATE(value) { (value), SEMA_OK, MUTEX_INIT }
55#define SEMA_CREATE_LOCKED() { (0), SEMA_OK, MUTEX_INIT_LOCKED }
138#if IS_USED(MODULE_SEMA_DEPRECATED)
159int _sema_wait_ztimer64(
sema_t *sema,
int block,
194#if IS_USED(MODULE_SEMA_DEPRECATED) || defined(DOXYGEN)
213 return _sema_wait_ztimer64(sema, (timeout != 0),
ZTIMER64_USEC, timeout);
void sema_create(sema_t *sema, unsigned int value)
Creates semaphore dynamically.
static int sema_wait(sema_t *sema)
Wait for a semaphore being posted (without timeout).
void sema_destroy(sema_t *sema)
Destroys a semaphore.
sema_state_t
A Semaphore states.
static int sema_wait_timed_ztimer(sema_t *sema, ztimer_clock_t *clock, uint32_t timeout)
Wait for a semaphore being posted, using ztimer as backend.
static unsigned sema_get_value(const sema_t *sema)
Get a semaphore's current value.
static int sema_wait_timed(sema_t *sema, uint64_t timeout)
Wait for a semaphore being posted with a 64bit timeout.
static int sema_try_wait(sema_t *sema)
Test if the semaphore is posted.
int sema_post(sema_t *sema)
Signal semaphore.
int _sema_wait_ztimer(sema_t *sema, int block, ztimer_clock_t *clock, uint32_t timeout)
Wait for a semaphore, blocking or non-blocking.
ztimer64_clock_t *const ZTIMER64_USEC
Default ztimer microsecond clock.
Mutex for thread synchronization.
mutex_t mutex
mutex of the semaphore
sema_state_t state
state of the semaphore
unsigned int value
value of the semaphore