kviewshell
GMonitorLock Class Reference
Wrapper for mutually exclusive code. More...
#include <GThreads.h>
Public Member Functions | |
GMonitorLock (GMonitor *gsec) | |
~GMonitorLock () |
Detailed Description
Wrapper for mutually exclusive code.This class locks a specified critical section (see {GCriticalSection}) at construction time and unlocks it at destruction time. It provides a convenient way to take advantage of the C++ implicit destruction of automatic variables in order to make sure that the monitor is released when exiting the protected code. The following code will release the monitor when the execution thread leaves the protected scope, either because the protected code has executed successfully, or because an exception was thrown. {verbatim} { -- protected scope static GMonitor theMonitor; GMonitorLock lock(&theMonitor) ... -- protected code } {verbatim} This construct will do nothing when passed a null pointer.
Definition at line 478 of file GThreads.h.
Constructor & Destructor Documentation
GMonitorLock::GMonitorLock | ( | GMonitor * | gsec | ) | [inline] |
GMonitorLock::~GMonitorLock | ( | ) | [inline] |
The documentation for this class was generated from the following file: