#include <mutex.hh>
Inheritance diagram for mpcl::system::IMutex:
Public Methods | |
virtual | ~IMutex (void) |
Destroys the instance. | |
virtual void | lock (void)=0 |
Lock mutex. | |
virtual void | unlock (void)=0 |
Unlock mutex. | |
virtual bool | tryLock (void)=0 |
A mutex is a MUTual EXclusion device, and is useful for protecting shared data structures from concurrent modifications, and implementing critical sections and monitors.
A mutex has two possible states: unlocked (not owned by any thread), and locked (owned by one thread). A mutex can never be owned by two different threads simultaneously. A thread attempting to lock a mutex that is already locked by another thread is suspended until the owning thread unlocks the mutex first.
Definition at line 53 of file mutex.hh.
|
Lock mutex if unlocked, if not, then it returns false.
Implemented in mpcl::system::TMutex. |