Exception-safe lock/unlock of a mutex. More...
#include <Mutex.h>
Public Member Functions | |
| ScopedMutexLock (Mutex &mutex) | |
| Create a lock on the mutex. | |
| ~ScopedMutexLock () | |
| The destructor automatically unlocks the mutex. | |
Private Member Functions | |
| ScopedMutexLock (const ScopedMutexLock &) | |
| Forbid copy constructor. | |
| ScopedMutexLock & | operator= (const ScopedMutexLock &) |
| Forbid assignment. | |
Private Attributes | |
| Mutex & | itsMutexRef |
Exception-safe lock/unlock of a mutex.
Public interface
The constructor of this class locks a mutex, while the destructor unlocks it. In this way the user does not need to take care of unlocking a mutex and is mutex locking fully exception-safe
Definition at line 97 of file Mutex.h.
| casacore::ScopedMutexLock::ScopedMutexLock | ( | Mutex & | mutex | ) | [inline] |
Create a lock on the mutex.
Definition at line 101 of file Mutex.h.
References itsMutexRef, and casacore::Mutex::lock().
| casacore::ScopedMutexLock::~ScopedMutexLock | ( | ) | [inline] |
The destructor automatically unlocks the mutex.
Definition at line 106 of file Mutex.h.
References itsMutexRef, and casacore::Mutex::unlock().
| casacore::ScopedMutexLock::ScopedMutexLock | ( | const ScopedMutexLock & | ) | [private] |
Forbid copy constructor.
| ScopedMutexLock& casacore::ScopedMutexLock::operator= | ( | const ScopedMutexLock & | ) | [private] |
Forbid assignment.
Mutex& casacore::ScopedMutexLock::itsMutexRef [private] |
Definition at line 115 of file Mutex.h.
Referenced by ScopedMutexLock(), and ~ScopedMutexLock().
1.6.1