casa
$Rev:20696$
|
Wrapper around a pthreads mutex. More...
#include <Mutex.h>
Public Types | |
enum | Type { Normal, ErrorCheck, Recursive, Default, Auto } |
Define the type of mutex. More... | |
Public Member Functions | |
Mutex (Type type=Auto) | |
Create the mutex. | |
~Mutex () | |
Destroy the mutex. | |
void | lock () |
Set a lock on the mutex. | |
void | unlock () |
Unlock the mutex. | |
bool | trylock () |
Try to lock the mutex. | |
Private Member Functions | |
Mutex (const Mutex &) | |
Forbid copy constructor. | |
Mutex & | operator= (const Mutex &) |
Forbid assignment. | |
Private Attributes | |
void * | itsMutex |
Wrapper around a pthreads mutex.
Public interface
This class is a wrapper around a phtreads mutex.
Although the Mutex class has a lock function, class ScopedMutexLock should be used to obtain a lock, because it makes locking exception-safe.
enum casa::Mutex::Type |
casa::Mutex::Mutex | ( | Type | type = Auto | ) |
Create the mutex.
Destroy the mutex.
casa::Mutex::Mutex | ( | const Mutex & | ) | [private] |
Forbid copy constructor.
void casa::Mutex::lock | ( | ) |
Set a lock on the mutex.
It waits till it gets the lock.
Referenced by casa::ScopedMutexLock::ScopedMutexLock().
bool casa::Mutex::trylock | ( | ) |
Try to lock the mutex.
True is returned if it succeeded.
void casa::Mutex::unlock | ( | ) |
Unlock the mutex.
Referenced by casa::ScopedMutexLock::~ScopedMutexLock().
void* casa::Mutex::itsMutex [private] |