The Mutex class is used to synchronize the execution of threads. More...
#include <Mutex.h>
Public Member Functions | |
| Mutex () | |
| Create and Initialize a Mutex object. More... | |
| Mutex (const char *name) | |
| Create and Initialize a Mutex object. More... | |
| void | lock () |
| Wait until a Mutex becomes available. More... | |
| osStatus | lock (uint32_t millisec) |
| Wait until a Mutex becomes available. More... | |
| bool | trylock () |
| Try to lock the mutex, and return immediately. More... | |
| bool | trylock_for (uint32_t millisec) |
| Try to lock the mutex for a specified time. More... | |
| bool | trylock_until (uint64_t millisec) |
| Try to lock the mutex until specified time. More... | |
| void | unlock () |
| Unlock the mutex that has previously been locked by the same thread. More... | |
| osThreadId_t | get_owner () |
| Get the owner the this mutex. More... | |
| ~Mutex () | |
| Mutex destructor. More... | |
The Mutex class is used to synchronize the execution of threads.
This is, for example, used to protect access to a shared resource.
In bare-metal builds, the Mutex class is a dummy, so lock() and unlock() are no-ops.
| osThreadId_t get_owner | ( | ) |
Get the owner the this mutex.
| osStatus lock | ( | uint32_t | millisec | ) |
Wait until a Mutex becomes available.
| millisec | timeout value. |