CACAO
Public Member Functions | Private Attributes | Friends
Mutex Class Reference

Dummy implementation of a mutex. More...

Public Member Functions

void lock ()
 Locks the given mutex object and checks for errors. More...
 
void unlock ()
 Unlocks the given mutex object and checks for errors. More...
 
 Mutex ()
 Initializes the given mutex object and checks for errors. More...
 
 ~Mutex ()
 Destroys the given mutex object and checks for errors. More...
 
void lock ()
 
void unlock ()
 

Private Attributes

pthread_mutex_t _mutex
 
pthread_mutexattr_t _attr
 

Friends

class Condition
 

Detailed Description

Dummy implementation of a mutex.

POSIX implementation of a mutex.

Definition at line 33 of file mutex-none.hpp.

Constructor & Destructor Documentation

Mutex::Mutex ( )
inline

Initializes the given mutex object and checks for errors.

Definition at line 61 of file mutex-posix.hpp.

Mutex::~Mutex ( )
inline

Destroys the given mutex object and checks for errors.

Definition at line 86 of file mutex-posix.hpp.

Member Function Documentation

void Mutex::lock ( )
inline

Locks the given mutex object and checks for errors.

If the mutex is already locked by another thread, the calling thread is suspended until the mutex is unlocked.

If the mutex is already locked by the calling thread, the same applies, thus effectively causing the calling thread to deadlock. (This is because we use "fast" pthread mutexes without error checking.)

Definition at line 35 of file mutex-none.hpp.

void Mutex::lock ( )
inline
void Mutex::unlock ( )
inline

Unlocks the given mutex object and checks for errors.

The mutex is assumed to be locked and owned by the calling thread.

Definition at line 36 of file mutex-none.hpp.

void Mutex::unlock ( )
inline

Friends And Related Function Documentation

friend class Condition
friend

Definition at line 45 of file mutex-posix.hpp.

Field Documentation

pthread_mutexattr_t Mutex::_attr
private

Definition at line 41 of file mutex-posix.hpp.

pthread_mutex_t Mutex::_mutex
private

Definition at line 40 of file mutex-posix.hpp.


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