OSB_LIB::Mutex Class Reference

Collaboration diagram for OSB_LIB::Mutex:

Collaboration graph
[legend]
List of all members.

Detailed Description

Wrapper to a POSIX mutex.

Definition at line 56 of file mutex.h.

Public Member Functions

Private Member Functions

Private Attributes


Constructor & Destructor Documentation

OSB_LIB::Mutex::Mutex ( const pthread_mutexattr_t *  attr = 0  ) 

Constructor with mutex attributes.

Parameters:
attr Mutex attributes used for initalization of mutex_, see pthread_mutexattr_init for details.

OSB_LIB::Mutex::~Mutex (  ) 

Destructor.

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

Prevent copying: not implemented.


Member Function Documentation

int OSB_LIB::Mutex::lock (  ) 

Lock the mutex.

The function locks the mutex. It blocks until the the mutex is aquired.

Returns:
0 in case of success, else a non-zero value as specified for pthread_mutex_lock.

Referenced by OSB_LIB::Shared< T >::lock().

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

Prevent assignment: not implemented.

int OSB_LIB::Mutex::trylock (  ) 

Try to lock the mutex.

The function tries to lock the mutex without waiting if already locked.

Returns:
0 in case of success, else a non-zero value:
  • EBUSY if the lock was not aquired because the mutex was already locked,
  • others as specified by pthread_mutex_trylock.

Referenced by OSB_LIB::Shared< T >::trylock().

int OSB_LIB::Mutex::unlock (  ) 

Unlock the mutex.

The funtion unlocks the mutex.

Returns:
0 in case of success, else a non-zero value as specified for pthread_mutex_unlock.

Referenced by OSB_LIB::Shared< T >::unlock().


Member Data Documentation

pthread_mutex_t OSB_LIB::Mutex::mutex_ [private]

The POSIX mutex.

Definition at line 109 of file mutex.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:11:32 2006 for OSB Library by  doxygen 1.4.7