StorageHelperRK
|
This is a wrapper around a recursive mutex, similar to Device OS RecursiveMutex. More...
#include <StorageHelperRK.h>
Public Member Functions | |
CustomRecursiveMutex (os_mutex_recursive_t handle) | |
Construct a CustomRecursiveMutex wrapper object from an existing recursive mutex. More... | |
CustomRecursiveMutex () | |
Default constructor with no mutex - one will be created on first lock. | |
~CustomRecursiveMutex () | |
Destroys the underlying mutex object. | |
void | dispose () |
Destroys the mutex object. | |
void | lock () const |
Locks the mutex. Creates a new recursive mutex object if it does not exist yet. More... | |
bool | trylock () const |
Attempts to lock the mutex. Creates a new recursive mutex object if it does not exist yet. More... | |
bool | try_lock () const |
Attempts to lock the mutex. Creates a new recursive mutex object if it does not exist yet. More... | |
void | unlock () const |
Unlocks the mutex. More... | |
This is a wrapper around a recursive mutex, similar to Device OS RecursiveMutex.
There are two differences:
|
inline |
Construct a CustomRecursiveMutex wrapper object from an existing recursive mutex.
handle | The mutex handle |
Ownership of the mutex handle is transferred to this object and it will be destroyed when this object is deleted.
|
inline |
Locks the mutex. Creates a new recursive mutex object if it does not exist yet.
Blocks if another thread has obtained the mutex, continues when the other thread releases it.
Never call lock from a SINGLE_THREADED_BLOCK since deadlock can occur.
|
inline |
Attempts to lock the mutex. Creates a new recursive mutex object if it does not exist yet.
Returns true if the mutex was locked or false if another thread has already locked it.
|
inline |
Attempts to lock the mutex. Creates a new recursive mutex object if it does not exist yet.
Returns true if the mutex was locked or false if another thread has already locked it.
|
inline |
Unlocks the mutex.
If another thread is blocked on locking the mutex, that thread will resume.