Main Page   Class Hierarchy   Compound List   Compound Members  

ArMutex Class Reference

Mutex wrapper class. More...

#include <ArMutex.h>

List of all members.

Public Types

enum  Status { STATUS_FAILED_INIT = 1, STATUS_FAILED, STATUS_ALREADY_LOCKED }

Public Methods

 ArMutex ()
 Constructor.

virtual ~ArMutex ()
 Destructor.

virtual int lock ()
 Lock the mutex. More...

virtual int tryLock ()
 Try to lock the mutex, but do not block. More...

virtual int unlock ()
 Unlock the mutex, allowing another thread to obtain the lock.

virtual std::string getError (int messageNumber)
 Get a human readable error message from an error code.

virtual MutexType & getMutex ()
 Get a reference to the underlying mutex variable.


Detailed Description

Mutex wrapper class.

This class wraps the operating systems mutex functions. It allows mutualy exclusive access to a critical section. This is extremely usefull for multiple threads which want to use the same variable. ArMutex simply uses the POSIX pthread interface in an object oriented manner. It also applies the same concept to Windows using Windows own abilities to restrict access to critical sections.


Member Enumeration Documentation

enum ArMutex::Status
 

Enumeration values:
STATUS_FAILED_INIT  Failed to initialize.
STATUS_FAILED  General failure.
STATUS_ALREADY_LOCKED  Mutex already locked.


Member Function Documentation

int ArMutex::lock   [virtual]
 

Lock the mutex.

Lock the mutex. This function will block until no other thread has this mutex locked. If it returns 0, then it obtained the lock and the thread is free to use the critical section that this mutex protects. Else it returns an error code. See getError().

int ArMutex::tryLock   [virtual]
 

Try to lock the mutex, but do not block.

Try to lock the mutex. This function will not block if another thread has the mutex locked. It will return instantly if that is the case. It will return STATUS_ALREADY_LOCKED if another thread has the mutex locked. If it obtains the lock, it will return 0.


The documentation for this class was generated from the following files:
Generated on Tue Nov 12 17:43:59 2002 for Aria by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001