class MutexLock

Mutex automatic locker for protected access. More...

Full nameost::MutexLock
Definition#include <thread.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


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.

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.

 MutexLock ( Mutex& _mutex )

MutexLock

Acquire the mutex

 ~MutexLock ()

~MutexLock

Release the mutex automatically