|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |
#include "ot/base/Mutex.h"
Multi-threaded synchronization object that enables mutually exclusive access to a protected resource.
A mutex can be acquired (locked) by only one thread at a time. A thread should not attempt to acquire a Mutex that it already owns (see RecursiveMutex if you require this).While a thread 'owns' the mutex (i.e. has it locked), it can safely use the protected resource, which may be a variable, a region of memory or anything else, in the knowledge that no other thread will be accessing it. However, this only holds true if all threads obey the rules and acquire the mutex before attempting to access the protected resource. This is where the 'mutual' part comes in - all programs that access the resource must acquire the mutex first.
Constructor/Destructor Summary | |
Mutex() Default constructor. | |
~Mutex() Destructor. |
Method Summary | |
void |
lock() Acquires the mutex. |
bool |
tryLock() Attempts to acquire the mutex without blocking. |
void |
unlock() Releases the mutex. |
Typedefs |
typedef AutoLock< Mutex > Lock
Constructor/Destructor Detail |
Mutex()
~Mutex()
Method Detail |
void lock()
bool tryLock()
void unlock()
|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |