casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::ScopedMutexLock Class Reference

Exception-safe lock/unlock of a mutex. More...

#include <Mutex.h>

Public Member Functions

 ScopedMutexLock (Mutex &mutex)
 Create a lock on the mutex. More...
 
 ~ScopedMutexLock ()
 The destructor automatically unlocks the mutex. More...
 

Private Member Functions

 ScopedMutexLock (const ScopedMutexLock &)
 Forbid copy constructor. More...
 
ScopedMutexLockoperator= (const ScopedMutexLock &)
 Forbid assignment. More...
 

Private Attributes

MutexitsMutexRef
 

Detailed Description

Exception-safe lock/unlock of a mutex.

Intended use:

Public interface

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25

Synopsis

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 146 of file Mutex.h.

Constructor & Destructor Documentation

casacore::ScopedMutexLock::ScopedMutexLock ( Mutex mutex)
inline

Create a lock on the mutex.

Definition at line 150 of file Mutex.h.

References itsMutexRef, and casacore::Mutex::lock().

casacore::ScopedMutexLock::~ScopedMutexLock ( )
inline

The destructor automatically unlocks the mutex.

Definition at line 155 of file Mutex.h.

References itsMutexRef, and casacore::Mutex::unlock().

casacore::ScopedMutexLock::ScopedMutexLock ( const ScopedMutexLock )
private

Forbid copy constructor.

Member Function Documentation

ScopedMutexLock& casacore::ScopedMutexLock::operator= ( const ScopedMutexLock )
private

Forbid assignment.

Member Data Documentation

Mutex& casacore::ScopedMutexLock::itsMutexRef
private

Definition at line 164 of file Mutex.h.

Referenced by ScopedMutexLock(), and ~ScopedMutexLock().


The documentation for this class was generated from the following file: