casa
$Rev:20696$
|
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
casa::ScopedMutexLock::ScopedMutexLock | ( | Mutex & | mutex | ) | [inline] |
Create a lock on the mutex.
Definition at line 101 of file Mutex.h.
References itsMutexRef, and casa::Mutex::lock().
casa::ScopedMutexLock::~ScopedMutexLock | ( | ) | [inline] |
The destructor automatically unlocks the mutex.
Definition at line 106 of file Mutex.h.
References itsMutexRef, and casa::Mutex::unlock().
casa::ScopedMutexLock::ScopedMutexLock | ( | const ScopedMutexLock & | ) | [private] |
Forbid copy constructor.
ScopedMutexLock& casa::ScopedMutexLock::operator= | ( | const ScopedMutexLock & | ) | [private] |
Forbid assignment.
Mutex& casa::ScopedMutexLock::itsMutexRef [private] |
Definition at line 115 of file Mutex.h.
Referenced by ScopedMutexLock(), and ~ScopedMutexLock().