MutexLock(3cc)

MutexLock3cc

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.

Usage

#include <thread.h>

Public Methods

MutexLock (Mutex &_mutex)
Acquire the mutex. ~MutexLock ()
Release the mutex automatically.

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 <[email protected]>

Constructor & destructor documentation

MutexLock::MutexLock (Mutex & _mutex) [inline]

Acquire the mutex.

MutexLock::~MutexLock () [inline]

Release the mutex automatically.

Author

Generated automatically by Doxygen for CommonC++ from the source code.

From libcommoncpp2-dev 1.0.13-5 in Debian 3.1 (Sarge). Parsed by carta from the page's man source.