![]() |
CMSIS-RTOS RTX
Version 4.80
CMSIS-RTOS RTX: Real-Time Operating System for Cortex-M processor-based devices
|
Synchronize thread execution with a Mutex. More...
Macros | |
#define | osMutexDef(name) |
Define a Mutex. | |
#define | osMutex(name) &os_mutex_def_##name |
Access a Mutex definition. | |
Functions | |
osMutexId | osMutexCreate (const osMutexDef_t *mutex_def) |
Create and Initialize a Mutex object. | |
osStatus | osMutexWait (osMutexId mutex_id, uint32_t millisec) |
Wait until a Mutex becomes available. | |
osStatus | osMutexRelease (osMutexId mutex_id) |
Release a Mutex that was obtained by osMutexWait. | |
osStatus | osMutexDelete (osMutexId mutex_id) |
Delete a Mutex that was created by osMutexCreate. | |
The Mutex Management function group is used to synchronize the execution of threads. This is for example used to protect access to a shared resource, for example a shared memory image.
#define osMutex | ( | name | ) | &os_mutex_def_##name |
Access to mutex object for the functions osMutexCreate.
name | name of the mutex object. |
#define osMutexDef | ( | name | ) |
Define a mutex object that is referenced by osMutex.
name | name of the mutex object. |
osMutexId osMutexCreate | ( | const osMutexDef_t * | mutex_def | ) |
[in] | mutex_def | mutex definition referenced with osMutex. |
Create and initialize a Mutex object.
Example
[in] | mutex_id | mutex ID obtained by osMutexCreate. |
Delete a Mutex object. The function releases internal memory obtained for Mutex handling. After this call the mutex_id is no longer valid and cannot be used. The Mutex may be created again using the function osMutexCreate.
Example
[in] | mutex_id | mutex ID obtained by osMutexCreate. |
Release a Mutex that was obtained with osMutexWait. Other threads that currently wait for the same mutex will be now put into the state READY.
Example
[in] | mutex_id | mutex ID obtained by osMutexCreate. |
[in] | millisec | Timout Value or 0 in case of no time-out. |
Wait until a Mutex becomes available. If no other thread has obtained the Mutex, the function instantly returns and blocks the mutex object.
The argument millisec specifies how long the system waits for a mutex. While the system waits the thread that is calling this function is put into the state WAITING. The millisec timeout can have the following values:
Example