Mutex Class Reference

Simplistic posix mutex class. More...

#include <mutex.h>

List of all members.

Public Member Functions

 Mutex ()
 ~Mutex ()
int lock ()
 Lock the mutex.
int unlock ()
 Unock the mutex.
bool tryLock ()
 Try to lock mutex.
bool isLocked ()
 Check if mutex is already locked.

Protected Attributes

pthread_mutex_t m_mutex


Detailed Description

Simplistic posix mutex class.

Not much to say. lock and unlock to synchronize your threads.

Definition at line 29 of file mutex.h.


Constructor & Destructor Documentation

Mutex::Mutex  ) 
 

Definition at line 23 of file mutex.cpp.

References m_mutex.

Mutex::~Mutex  ) 
 

Definition at line 28 of file mutex.cpp.


Member Function Documentation

bool Mutex::isLocked  ) 
 

Check if mutex is already locked.

Returns:
true if mutex is already locked

Definition at line 47 of file mutex.cpp.

References m_mutex.

int Mutex::lock  ) 
 

Lock the mutex.

Returns:
pthread_mutex_lock return value

Definition at line 32 of file mutex.cpp.

References m_mutex.

Referenced by MutexLocker::MutexLocker(), VC820::run(), PeakTech10Ascii::run(), M9803R::run(), GDM703::setAscii(), and MetexAscii::setMetexAscii().

bool Mutex::tryLock  ) 
 

Try to lock mutex.

If it is already locked function returns false.

Returns:
true is successfull. false if already locked

Definition at line 42 of file mutex.cpp.

References m_mutex.

int Mutex::unlock  ) 
 

Unock the mutex.

Returns:
pthread_mutex_unlock return value

Definition at line 37 of file mutex.cpp.

References m_mutex.

Referenced by VC820::run(), PeakTech10Ascii::run(), M9803R::run(), GDM703::setAscii(), MetexAscii::setMetexAscii(), and MutexLocker::~MutexLocker().


Member Data Documentation

pthread_mutex_t Mutex::m_mutex [protected]
 

Definition at line 58 of file mutex.h.

Referenced by isLocked(), lock(), Mutex(), tryLock(), and unlock().


The documentation for this class was generated from the following files:
Generated on Mon Jan 22 23:24:19 2007 for cdmm by  doxygen 1.4.6