Base Framework
|
Mutual exclusion synchronization object. More...
#include <base/concurrency/MutualExclusion.h>
Public Types | |
typedef ExclusiveSynchronize< MutualExclusion > | Sync |
![]() | |
typedef ExclusiveSynchronize< Lock > | Sync |
Public Member Functions | |
MutualExclusion () | |
void | exclusiveLock () const |
bool | tryExclusiveLock () const |
void | sharedLock () const |
bool | trySharedLock () const |
void | releaseLock () const |
~MutualExclusion () | |
![]() | |
String | getDescription () const |
void | setDescription (const String &description) |
unsigned int | getResourceId () const |
unsigned int | getCreatedById () const |
AnyReference | getHandle () const noexcept |
template<class TYPE > | |
TYPE & | getInternalHandle () const |
operator bool () const noexcept | |
![]() | |
Lock () noexcept | |
virtual | ~Lock () |
Additional Inherited Members | |
![]() | |
AnyReference | handle |
Mutual exclusion synchronization object.
This class implements a mutual exclusion object used to protect shared data structures from concurrent modifications, implementing critical sections and monitors. Please note that the lock/unlock mechanism is considered a non-modifying property of a class.
MutualExclusion::MutualExclusion | ( | ) |
Initializes a mutual exclusion object in the unlocked state. Raises ResourceException if unable to initialize the object.
MutualExclusion::~MutualExclusion | ( | ) |
Destroys the mutual exclusion object. The mutual exclusion must be in the unlocked state prior to destruction. Raises MutualExclusionException on failure.
|
virtual |
Requests a lock on this mutual exclusion object. The calling thread is suspended if the mutex has been locked by another thread. Does nothing if the calling thread already has a lock on the object. Raises MutualExclusionException on undefined failure.
Implements Lock.
|
virtual |
This method unlocks this mutual exclusion object. The calling thread must have a lock on this mutual exlusion object prior to invocation otherwise the behavior is undefined. Raises MutualExclusionException on failure.
Implements Lock.
|
inlinevirtual |
Requests a lock on this mutual exclusion object. The calling thread is suspended if the mutex has been locked by another thread. Does nothing if the calling thread already has a lock on the object. Raises MutualExclusionException on undefined failure.
Implements Lock.
|
virtual |
Attempts to lock this mutual exclusion object. Raises MutualExclusionException on failure.
Implements Lock.
|
inlinevirtual |
Attempts to lock this mutual exclusion object. Raises MutualExclusionException on failure.
Implements Lock.