EtcPal
0.4.1
ETC Platform Abstraction Layer (EtcPal)
|
View other versions:
|
A wrapper class for the EtcPal mutex type.
Note: The etcpal::Mutex functions are not normally used directly - prefer usage of the RAII type etcpal::MutexGuard to manage locking and Unlocking of an etcpal::Mutex.
Example usage:
See mutex (Mutexes) for more information.
Public Member Functions | |
Mutex () | |
Create a new mutex. | |
~Mutex () | |
Destroy the mutex. | |
Mutex (const Mutex &other)=delete | |
Mutex & | operator= (const Mutex &other)=delete |
Mutex (Mutex &&other)=delete | |
Mutex & | operator= (Mutex &&other)=delete |
bool | Lock () |
Lock the mutex. More... | |
bool | TryLock (int timeout_ms=0) |
Attempt to lock the mutex. More... | |
void | Unlock () |
Unlock the mutex. More... | |
etcpal_mutex_t & | get () |
Get a reference to the underlying etcpal_mutex_t type. | |
|
inline |
Lock the mutex.
|
inline |
Attempt to lock the mutex.
Returns when either the mutex is acquired or the timeout expires. NOTE: Timeout values other than 0 or ETCPAL_WAIT_FOREVER are typically only honored on real-time platforms. See the table in mutex (Mutexes) for more information. On platforms where timeouts are not honored, passing 0 for timeout_ms executes a poll for the mutex returning immediately, while any other value executes the equivalent of Lock().
timeout_ms | How long to wait to acquire the mutex, in milliseconds. Default is to poll and return immediately. |
|
inline |
Unlock the mutex.
See etcpal_mutex_Unlock().