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

Constructor & Destructor Documentation

◆ ScopedMutexLock() [1/2]

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

Create a lock on the mutex.

Definition at line 101 of file Mutex.h.

◆ ~ScopedMutexLock()

casacore::ScopedMutexLock::~ScopedMutexLock ( )
inline

The destructor automatically unlocks the mutex.

Definition at line 106 of file Mutex.h.

References casacore::Mutex::operator=().

◆ ScopedMutexLock() [2/2]

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

Forbid copy constructor.

Member Function Documentation

◆ operator=()

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

Forbid assignment.

Member Data Documentation

◆ itsMutexRef

Mutex& casacore::ScopedMutexLock::itsMutexRef
private

Definition at line 115 of file Mutex.h.


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