|
MLIB
|
Automatic wrapper for critical sections. More...
#include <critsect.h>
Public Member Functions | |
| lock (criticalsection &cs) | |
| Acquire critical section. | |
| lock (const lock &t) | |
| Copy constructor. | |
| ~lock () | |
| Leave critical section. | |
Automatic wrapper for critical sections.
Used in conjunction with criticalsection objects, locks simplify critical sections' management by taking advantage the automatic destruction of static objects in C++.
Use it as in example below:
The main advantage however is that any exception thrown inside func or any called function will also invoke the destructor for lock thus releasing the critical section.