Morse Micro IoT SDK  2.11.2

Detailed Description

Provides binary semaphore support for task synchronization.

Functions

struct mmosal_semb * mmosal_semb_create (const char *name)
 Create a new binary semaphore. More...
 
void mmosal_semb_delete (struct mmosal_semb *semb)
 Delete the given binary semaphore. More...
 
bool mmosal_semb_give (struct mmosal_semb *semb)
 Give a binary semaphore. More...
 
bool mmosal_semb_give_from_isr (struct mmosal_semb *semb)
 Give a binary semaphore (from ISR context). More...
 
bool mmosal_semb_wait (struct mmosal_semb *semb, uint32_t timeout_ms)
 Wait for a counting semaphore. More...
 

Function Documentation

◆ mmosal_semb_create()

struct mmosal_semb * mmosal_semb_create ( const char *  name)

Create a new binary semaphore.

Parameters
nameThe name of the semaphore.
Returns
an opaque handle to the semaphore, or NULL on failure.

◆ mmosal_semb_delete()

void mmosal_semb_delete ( struct mmosal_semb *  semb)

Delete the given binary semaphore.

Parameters
sembSemaphore to delete.

◆ mmosal_semb_give()

bool mmosal_semb_give ( struct mmosal_semb *  semb)

Give a binary semaphore.

Warning
May not be invoked from an ISR.
Parameters
sembThe semaphore to give.
Returns
true on success, else false.

◆ mmosal_semb_give_from_isr()

bool mmosal_semb_give_from_isr ( struct mmosal_semb *  semb)

Give a binary semaphore (from ISR context).

Warning
May only be invoked from an ISR.
Parameters
sembThe semaphore to give.
Returns
true on success, else false.

◆ mmosal_semb_wait()

bool mmosal_semb_wait ( struct mmosal_semb *  semb,
uint32_t  timeout_ms 
)

Wait for a counting semaphore.

Parameters
sembThe semaphore to wait for.
timeout_msTimeout after which to give up waiting (in milliseconds).
Returns
true if the the semaphore was taken successfully, else false.