LTI-Lib latest version v1.9 - last update 24 Nov 2005
Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

lti::mutex Class Reference

lti mutex class More...

#include <ltiMutex.h>

Inheritance diagram for lti::mutex:

Inheritance graph
[legend]
Collaboration diagram for lti::mutex:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 mutex ()
virtual ~mutex ()
void lock ()
bool tryLock ()
void unlock ()
virtual const char * getTypeName () const

Protected Attributes

pthread_mutex_t theMutex

Detailed Description

lti mutex class

This object can be used to protect critical sections on multithreaded applications. The same thread should NOT try to lock the mutex more than once. The behavior of this will depend on the operating system: on linux/unix the thread will be locked forever (posix standard); on windows, the thread will count how many lock have been done, but it will not be blocked by the later locks!

See also:
lti::semaphore, lti::thread


Constructor & Destructor Documentation

lti::mutex::mutex  ) 
 

default constructor

virtual lti::mutex::~mutex  )  [virtual]
 

destructor


Member Function Documentation

virtual const char* lti::mutex::getTypeName  )  const [virtual]
 

returns the name of this type

Reimplemented from lti::object.

void lti::mutex::lock  ) 
 

wait until lock for mutex becomes available and lock it

bool lti::mutex::tryLock  ) 
 

Try to lock mutex, but do not block.

Returns:
true if locking was successful.

void lti::mutex::unlock  ) 
 

unlock mutex


Member Data Documentation

pthread_mutex_t lti::mutex::theMutex [protected]
 

the posix mutex object


The documentation for this class was generated from the following file:
Generated on Thu Nov 24 17:11:28 2005 for LTI-Lib by Doxygen 1.4.4