CriticalSection

Name

CriticalSection -- Simple, safe critical section

Synopsis


#include <CMutex.h>
       CriticalSection
      
  CriticalSection(CMutex& mutex);
   

DESCRIPTION

Implements an easy to use critical section on top of a mutex. To use, simply construct the CriticalSection object in the block that needs synchronization. The constructor will lock the mutex and unlock it when destroyed (when the block is exited)

EXAMPLE


#include <CMutex.h>
...

CMutex guard;
...
{
    CriticalSection s(guard);                 // Locks guard
    ...
    throw someException;                    // unlocks guard.
    ...
    
}                                           // unlocks guard.