casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Private Member Functions | Private Attributes
casa::Mutex Class Reference

Wrapper around a pthreads mutex. More...

#include <Mutex.h>

List of all members.

Public Types

enum  Type {
 Define the type of mutex. More...

Public Member Functions

 Mutex (Type type=Auto)
 Create the mutex.
 ~Mutex ()
 Destroy the mutex.
void lock ()
 Set a lock on the mutex.
void unlock ()
 Unlock the mutex.
bool trylock ()
 Try to lock the mutex.

Private Member Functions

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

Private Attributes

void * itsMutex

Detailed Description

Wrapper around a pthreads mutex.

Intended use:

Public interface

Review Status

Reviewed By:
Date Reviewed:


This class is a wrapper around a phtreads 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 49 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.


Definition at line 56 of file Mutex.h.

Constructor & Destructor Documentation

Create the mutex.

Destroy the mutex.

casa::Mutex::Mutex ( const Mutex ) [private]

Forbid copy constructor.

Member Function Documentation

Set a lock on the mutex.

It waits till it gets the lock.

Referenced by casa::ScopedMutexLock::ScopedMutexLock().

Mutex& casa::Mutex::operator= ( const Mutex ) [private]

Forbid assignment.

Try to lock the mutex.

True is returned if it succeeded.

Unlock the mutex.

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

Member Data Documentation

void* casa::Mutex::itsMutex [private]

Definition at line 81 of file Mutex.h.

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