A two-layer mutex, typically used for status+data protection. More...
#include <xsens_mutex.h>
Public Member Functions | |
bool | claimMutex () |
GuardedMutex () | |
Constructor. More... | |
bool | isUsing (Mutex const *mutex) const |
Check if the guarded mutex is equal to the supplied mutex. More... | |
bool | releaseMutex () |
int | status () const volatile |
MutexReadWriteSuspendable & | suspendable () |
~GuardedMutex () | |
Destructor. More... | |
Protected Member Functions | |
bool | haveReadClaim () const volatile |
bool | haveWriteClaim () const volatile |
Private Member Functions | |
GuardedMutex (GuardedMutex &&)=delete | |
GuardedMutex (GuardedMutex const &)=delete | |
GuardedMutex & | operator= (GuardedMutex &&)=delete |
GuardedMutex & | operator= (GuardedMutex const &)=delete |
![]() | |
MutexReadWriteSuspendable () | |
int | status () const volatile |
~MutexReadWriteSuspendable () | |
bool | claimMutex (bool write) |
Claims (locks) a mutex for read or write modes. More... | |
bool | claimMutex (Mode mode) |
Claims (locks) a mutex using a given mode. More... | |
bool | downgradeToRead (bool decreaseSuspend) |
Downgrade an existing write lock to a read lock. More... | |
bool | haveReadClaim () const volatile |
bool | haveWriteClaim () const volatile |
bool | releaseMutex (bool write, bool decreaseSuspendCount) |
Releases (unlocks) a mutex for read or write modes. More... | |
bool | releaseMutex (Mode mode, bool decreaseSuspendCount) |
Releases (unlocks) a mutex using a given mode. More... | |
bool | resumeWriteLock () |
Resumes an existing write lock so read locks are no longer allowed. More... | |
bool | suspendWriteLock () |
Suspend an existing write lock so read locks are allowed, but do not allow other write locks. More... | |
Private Attributes | |
Mutex | m_guarded |
Friends | |
class | LockGuarded |
class | LockSuspendable |
Additional Inherited Members | |
![]() | |
enum | Mode { Mode::Read, Mode::Write, Mode::SuspendedWrite } |
An enum class that holds a three different modes of a suspendable mutex. More... | |
A two-layer mutex, typically used for status+data protection.
The class provides a main suspendable mutex, which can be used for all kinds of status updates and a deeper guarded mutex, which will enforce the main mux to be locked before allowing itself to be locked.
Definition at line 1259 of file xsens_mutex.h.
|
privatedelete |
|
privatedelete |
|
inline |
Constructor.
Definition at line 1275 of file xsens_mutex.h.
|
inline |
Destructor.
Definition at line 1281 of file xsens_mutex.h.
|
inline |
Definition at line 1287 of file xsens_mutex.h.
|
inlineprotected |
Definition at line 938 of file xsens_mutex.h.
|
inlineprotected |
Definition at line 931 of file xsens_mutex.h.
|
inline |
Check if the guarded mutex is equal to the supplied mutex.
mutex | The supplied mutex |
Definition at line 1314 of file xsens_mutex.h.
|
privatedelete |
|
privatedelete |
|
inline |
Definition at line 1295 of file xsens_mutex.h.
|
inline |
Definition at line 1320 of file xsens_mutex.h.
|
inline |
Definition at line 1305 of file xsens_mutex.h.
|
friend |
Definition at line 1263 of file xsens_mutex.h.
|
friend |
Definition at line 1264 of file xsens_mutex.h.
|
private |
Definition at line 1262 of file xsens_mutex.h.