#include <osaMutex.h>
Collaboration diagram for osaMutex:

Mutex class provided to create mutual exclusion around critical sections. This class relies on Posix threads mutex when possible. On Windows, it uses an actual Mutex which provides a locking mechanism between threads as well as processes. It doesn't rely on the more specialized CriticalSection type (between threads only).
Definition at line 47 of file osaMutex.h.
Definition at line 60 of file osaMutex.h.
| enum osaMutex::ReturnType |
Enum type for return values of a lock operation.
Definition at line 68 of file osaMutex.h.
| osaMutex::osaMutex | ( | void | ) |
Default constructor. Initialize the underlying mutex.
| osaMutex::~osaMutex | ( | void | ) |
Default destructor. Cleanup the underlying mutex.
| void osaMutex::Lock | ( | void | ) |
Mutex lock operation. This class doesn't use recursive mutexes therefore you must make sure the mutex is not already locked. Locking the same mutex twice from the same threads leads to undefined results.
Referenced by osaThreadedLogFileStreambuf< _element, _trait >::overflow(), osaThreadedLogFileStreambuf< _element, _trait >::sync(), and osaThreadedLogFileStreambuf< _element, _trait >::xsputn().
| void osaMutex::Unlock | ( | void | ) |
Mutex unlock operation. Be careful, one should never unlock an already unlocked mutex, this would lead to undefined results.
Referenced by osaThreadedLogFileStreambuf< _element, _trait >::overflow(), osaThreadedLogFileStreambuf< _element, _trait >::sync(), and osaThreadedLogFileStreambuf< _element, _trait >::xsputn().
| ReturnType osaMutex::TryLock | ( | int | timeout | ) |
Mutex lock operation with timeout
| timeout | If timeout == WAIT_FOREVER then the calling thread is blocked (this is same as calling Lock()). If timeout == NO_WAIT then the function returns after checking if the mutex can be locked or not. If timeout > 0 then the function waits for the specified amount of time (units to be specified later) before returning. |