Main Page   Modules   Class Hierarchy   Compound List   Compound Members  

GAUGE3D::GMutex Class Reference

Use to prevent data corruption caused by multiple threads accessing the same data. More...

#include <gauge3d/osabstraction/thread.h>

Inherits GAUGE3D::GObject.

List of all members.

Public Methods

 GMutex ()
 Create the mutex.

 ~GMutex ()
 Destroy the mutex. It must be unlocked when this happens.

void Lock ()
 Wait until mutex is unlocked, and then lock the mutex to this thread.

bool TryLock ()
 Check if mutex is locked, and lock it to this thread if not. More...

void Unlock ()
 Release lock on a thread. More...


Detailed Description

Use to prevent data corruption caused by multiple threads accessing the same data.

If two or more threads can access the same data, and at least one is writing to it, you should use a mutex to prevent them from accessing it at the same time.


Member Function Documentation

bool GAUGE3D::GMutex::TryLock ( )
 

Check if mutex is locked, and lock it to this thread if not.

Returns:
True if the mutex was not locked (and is now locked to the calling thread), or false if the mutex was locked by another thread at the time.

void GAUGE3D::GMutex::Unlock ( )
 

Release lock on a thread.

Only the thread that the mutex is locked to may call this.


The documentation for this class was generated from the following file:
Generated at Tue Jan 30 17:07:34 2001 for gauge3d by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000