Morse Micro IoT SDK  2.9.7

Detailed Description

Provides mutex support for mutual exclusion.

Macros

#define MMOSAL_MUTEX_GET_INF(_mutex)
 Attempt to get a mutex, waiting infinitely long for it. More...
 
#define MMOSAL_MUTEX_RELEASE(_mutex)
 Same as mmosal_mutex_release() except it panics on failure. More...
 

Functions

struct mmosal_mutex * mmosal_mutex_create (const char *name)
 Create a new mutex. More...
 
void mmosal_mutex_delete (struct mmosal_mutex *mutex)
 Delete a mutex. More...
 
bool mmosal_mutex_get (struct mmosal_mutex *mutex, uint32_t timeout_ms)
 Acquire a mutex. More...
 
bool mmosal_mutex_release (struct mmosal_mutex *mutex)
 Release a mutex. More...
 
bool mmosal_mutex_is_held_by_active_task (struct mmosal_mutex *mutex)
 Check whether the given mutex is held by the active thread. More...
 

Macro Definition Documentation

◆ MMOSAL_MUTEX_GET_INF

#define MMOSAL_MUTEX_GET_INF (   _mutex)
Value:
do { \
bool ok__ = mmosal_mutex_get((_mutex), UINT32_MAX); \
MMOSAL_ASSERT(ok__); \
} while (0)
bool mmosal_mutex_get(struct mmosal_mutex *mutex, uint32_t timeout_ms)
Acquire a mutex.

Attempt to get a mutex, waiting infinitely long for it.

Panics on failure.

Definition at line 354 of file mmosal.h.

◆ MMOSAL_MUTEX_RELEASE

#define MMOSAL_MUTEX_RELEASE (   _mutex)
Value:
do { \
bool ok__ = mmosal_mutex_release(_mutex); \
MMOSAL_ASSERT(ok__); \
} while (0)
bool mmosal_mutex_release(struct mmosal_mutex *mutex)
Release a mutex.

Same as mmosal_mutex_release() except it panics on failure.

Definition at line 363 of file mmosal.h.

Function Documentation

◆ mmosal_mutex_create()

struct mmosal_mutex * mmosal_mutex_create ( const char *  name)

Create a new mutex.

Parameters
nameThe name for the mutex.
Returns
an opaque handle to the mutex, or NULL on failure.

Definition at line 50 of file mmosal_shim_bootloader.c.

◆ mmosal_mutex_delete()

void mmosal_mutex_delete ( struct mmosal_mutex *  mutex)

Delete a mutex.

Parameters
mutexHandle of mutex to delete

Definition at line 56 of file mmosal_shim_bootloader.c.

◆ mmosal_mutex_get()

bool mmosal_mutex_get ( struct mmosal_mutex *  mutex,
uint32_t  timeout_ms 
)

Acquire a mutex.

Parameters
mutexHandle of mutex to acquire.
timeout_msTimeout after which to give up. To wait infinitely use UINT32_MAX.
Returns
true if the mutex was acquired successfully otherwise false.

Definition at line 61 of file mmosal_shim_bootloader.c.

◆ mmosal_mutex_is_held_by_active_task()

bool mmosal_mutex_is_held_by_active_task ( struct mmosal_mutex *  mutex)

Check whether the given mutex is held by the active thread.

Parameters
mutexHandle of the mutex to check.
Returns
true if the mutex is held by the active thread, else false.

◆ mmosal_mutex_release()

bool mmosal_mutex_release ( struct mmosal_mutex *  mutex)

Release a mutex.

Parameters
mutexHandle of mutex to release.
Returns
true if the mutex was released successfully otherwise false.

Definition at line 68 of file mmosal_shim_bootloader.c.