23 #ifndef ETCPAL_CPP_SEM_H_
24 #define ETCPAL_CPP_SEM_H_
27 #include "etcpal/sem.h"
84 bool TryWait(
int timeout_ms = 0);
A wrapper class for the EtcPal counting semaphore type.
Definition: sem.h:69
static constexpr unsigned int kDefaultMaxCount
The default value used for the semaphore's max_count.
Definition: sem.h:73
etcpal_sem_t & get()
Get a reference to the underlying etcpal_sem_t type.
Definition: sem.h:146
bool PostFromIsr()
Post the semaphore from an interrupt context.
Definition: sem.h:140
~Semaphore()
Destroy the semaphore.
Definition: sem.h:101
bool Post()
Post the semaphore.
Definition: sem.h:130
Semaphore(unsigned int initial_count=0, unsigned int max_count=kDefaultMaxCount)
Create a new semaphore.
Definition: sem.h:95
bool TryWait(int timeout_ms=0)
Wait for the semaphore until either it is received or a timeout expires.
Definition: sem.h:122
bool Wait()
Wait for the semaphore.
Definition: sem.h:108
Common definitions used by EtcPal C++ wrappers.
bool etcpal_sem_create(etcpal_sem_t *id, unsigned int initial_count, unsigned int max_count)
Create a new counting semaphore.
PLATFORM_DEFINED etcpal_sem_t
The semaphore identifier.
Definition: sem.dox:72
bool etcpal_sem_post(etcpal_sem_t *id)
Post a semaphore.
void etcpal_sem_destroy(etcpal_sem_t *id)
Destroy a semaphore object.
bool etcpal_sem_post_from_isr(etcpal_sem_t *id)
Post a semaphore from an interrupt context.
bool etcpal_sem_timed_wait(etcpal_sem_t *id, int timeout_ms)
Wait for a semaphore, giving up after a timeout.
bool etcpal_sem_wait(etcpal_sem_t *id)
Wait for a semaphore.