|
casacore
|
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. More... | |
| ~Mutex () | |
| Destroy the mutex. More... | |
| void | lock () |
| Set a lock on the mutex. More... | |
| void | unlock () |
| Unlock the mutex. More... | |
| bool | trylock () |
| Try to lock the mutex. More... | |
Private Member Functions | |
| Mutex (const Mutex &) | |
| Forbid copy constructor. More... | |
| Mutex & | operator= (const Mutex &) |
| Forbid assignment. More... | |
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.
| casacore::Mutex::~Mutex | ( | ) |
Destroy the mutex.
|
private |
Forbid copy constructor.
| void casacore::Mutex::lock | ( | ) |
Set a lock on the mutex.
It waits till it gets the lock.
Forbid assignment.
Referenced by casacore::MutexedInit::mutex(), and casacore::ScopedMutexLock::~ScopedMutexLock().
| bool casacore::Mutex::trylock | ( | ) |
Try to lock the mutex.
True is returned if it succeeded.
| void casacore::Mutex::unlock | ( | ) |
Unlock the mutex.
|
private |
Definition at line 81 of file Mutex.h.
Referenced by casacore::MutexedInit::mutex().
1.8.12