Create a new unlocked Mutex
FAILs with LOCK_FAILURE if the underlying pthread_mutex cannot be initialized.
Destroy a Mutex
FAILs with LOCK_FAILURE if:
- The Mutex is currently locked
- the underlying pthread_mutex_destroy fails.
void MFM::Mutex::AssertIHoldTheLock |
( |
| ) |
|
|
inline |
Confirm that the current thread holds the lock.
FAILs with LOCK_FAILURE if:
- The mutex is currently not locked
- The mutex is locked but the current thread did not lock it
bool MFM::Mutex::IsLockedByAnother |
( |
| ) |
|
|
inline |
Test if the lock is held by a thread other than the current thread.
- Returns
- false if the mutex is currently unlocked; true if it is locked by a thread other than the current thread.
FAILs with LOCK_FAILURE if:
- The mutex is locked by the current thread
void MFM::Mutex::Lock |
( |
| ) |
|
|
inline |
Locks the underlying mutex, blocking as long as necessary to acquire it.
FAILs with LOCK_FAILURE if:
- The mutex is already locked by the current thread
bool MFM::Mutex::TryLock |
( |
| ) |
|
|
inline |
Attempt to lock the underlying mutex, without blocking
- Returns
- true if the lock was successfully taken, else false.
FAILs with LOCK_FAILURE if:
- the Mutex is already locked by the calling thread.
void MFM::Mutex::Unlock |
( |
| ) |
|
|
inline |
Unlocks the underlying mutex.
FAILs with LOCK_FAILURE if:
- The mutex is currently not locked
- The mutex is locked but the current thread did not lock it
The documentation for this class was generated from the following files:
- src/core/include/Mutex.h
- src/core/src/Mutex.cpp