class GCriticalSectionLock

Wrapper for mutually exclusive code.

Public Methods

[more] GCriticalSectionLock(GCriticalSection *gsec)
Constructor.
[more] ~GCriticalSectionLock()
Destructor.


Documentation

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 critical section is unlocked when exiting the protected code. The following code will release the lock when the execution thread leaves the protected scope, either because the protected code has executed successfully, or because an exception was thrown.
      {      -- protected scope
         static GCriticalSection theSection;
         GCriticalSectionLock lock(&theSection)
         ... -- protected code
      }
    
o GCriticalSectionLock(GCriticalSection *gsec)
Constructor. Locks the critical section object gsec.

o ~GCriticalSectionLock()
Destructor. Releases the associated critical section.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java