MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Data Structures | Public Member Functions
MFM::Mutex Class Reference

Data Structures

class  Predicate
 
class  ScopeLock
 

Public Member Functions

 Mutex ()
 
 ~Mutex ()
 
bool TryLock ()
 
void Lock ()
 
void AssertIHoldTheLock ()
 
void Unlock ()
 
bool IsLockedByAnother ()
 
void ReportMutexStatus (int level)
 

Constructor & Destructor Documentation

MFM::Mutex::Mutex ( )
inline

Create a new unlocked Mutex

FAILs with LOCK_FAILURE if the underlying pthread_mutex cannot be initialized.

MFM::Mutex::~Mutex ( )
inline

Destroy a Mutex

FAILs with LOCK_FAILURE if:

  • The Mutex is currently locked
  • the underlying pthread_mutex_destroy fails.

Member Function Documentation

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: