table of contents
ost::MutexLock(3) | Library Functions Manual | ost::MutexLock(3) |
NAME¶
ost::MutexLock - 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.SYNOPSIS¶
#include <thread.h>Public Member Functions¶
MutexLock (Mutex &_mutex)
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. It use Mutex to protect operation. Using this class is usefull and exception safe. The mutex that has been locked is automatically released when the function call stack falls out of scope, so one doesnt have to remember to unlock the mutex at each function return. 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 Mutex
automatic locker for protected access.
Constructor & Destructor Documentation¶
ost::MutexLock::MutexLock ( Mutex &_mutex) [inline]¶
Acquire the mutex. Parameters:_mutex reference to mutex to aquire.
ost::MutexLock::~MutexLock () [inline]¶
Release the mutex automatically.Author¶
Generated automatically by Doxygen for GNU CommonC++ from the source code.Sun Dec 29 2013 | GNU CommonC++ |