Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

MutexLock Class Reference

The MutexLock class is used to protect a section of code so that at any given time only a single thread can perform the protected operation. Mutex automatic locker for protected access. More...

#include <thread.h>

List of all members.

Public Methods

 MutexLock (Mutex &_mutex)
 Acquire the mutex. More...

 ~MutexLock ()
 Release the mutex automatically. More...


Detailed Description

The MutexLock class is used to protect a section of code so that at any given time only a single thread can perform the protected operation. Mutex automatic locker for protected access.

It use Mutex to protect operation. Using this class is usefull and exception safe.

A common use is

void func_to_protect() { MutexLock lock(mutex); ... operation ... }

NOTE: do not declare variable as "MutexLock (mutex)", the mutex will be released at statement end.

Author:
Frediano Ziglio <freddy77@angelfire.com>


Constructor & Destructor Documentation

MutexLock::MutexLock Mutex &   _mutex [inline]
 

Acquire the mutex.

MutexLock::~MutexLock   [inline]
 

Release the mutex automatically.


The documentation for this class was generated from the following file:
Generated at Tue Nov 20 12:34:35 2001 for CommonC++ by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001