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

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 (Mutex::Type=Auto)
 
 ~Mutex ()
 
void lock ()
 
void unlock ()
 
bool trylock ()
 

Private Member Functions

 Mutex (const Mutex &)
 Forbid copy constructor. More...
 
Mutexoperator= (const Mutex &)
 Forbid assignment. More...
 

Detailed Description

Wrapper around a pthreads mutex.

Intended use:

Public interface

Review Status

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

Synopsis

This class is a wrapper around a pthreads mutex.
Although the Mutex class has a lock function, class ScopedMutexLock should be used to obtain a lock, because it makes locking exception-safe.

Definition at line 58 of file Mutex.h.

Member Enumeration Documentation

Define the type of mutex.

(see phtread_mutexattr_settype for their meaning). In Debug mode, type Auto will use PTHREAD_MUTEX_ERRORCHECK, otherwise PTHREAD_MUTEX_DEFAULT.

Enumerator
Normal 
ErrorCheck 
Recursive 
Default 
Auto 

Definition at line 65 of file Mutex.h.

Constructor & Destructor Documentation

casacore::Mutex::Mutex ( Mutex::Type  = Auto)
inline

Definition at line 113 of file Mutex.h.

casacore::Mutex::~Mutex ( )
inline

Definition at line 114 of file Mutex.h.

casacore::Mutex::Mutex ( const Mutex )
private

Forbid copy constructor.

Member Function Documentation

void casacore::Mutex::lock ( )
inline

Definition at line 115 of file Mutex.h.

Referenced by casacore::ScopedMutexLock::ScopedMutexLock().

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

Forbid assignment.

bool casacore::Mutex::trylock ( )
inline

Definition at line 117 of file Mutex.h.

void casacore::Mutex::unlock ( )
inline

Definition at line 116 of file Mutex.h.

Referenced by casacore::ScopedMutexLock::~ScopedMutexLock().


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