H3D::MutexLock Class Reference

Mutual exclusion lock class for synchronisation between threads. More...

#include <Threads.h>

Inheritance diagram for H3D::MutexLock:

Inheritance graph
List of all members.

Public Member Functions

 MutexLock ()
 Constructor.
 ~MutexLock ()
 Destructor.
void lock ()
 Locks the mutex.
void unlock ()
 Unlocks the mutex.
bool tryLock ()
 Try to lock the mutex, if the lock is not available false is returned.

Protected Attributes

pthread_mutex_t mutex

Detailed Description

Mutual exclusion lock class for synchronisation between threads.

Most common usage is to make sure that only one thread enters a "critical section" at a time. E.g. if both threads uses the same variable we must put a lock around the access to make sure that two threads does not access it at once.


Member Function Documentation

void MutexLock::lock  ) 
 

Locks the mutex.

If already locked, waits until it is unlocked and then locks it.


Generated on Thu Aug 24 12:40:09 2006 for H3D API by  doxygen 1.4.5