CGaurdedObject

Name

CGaurdedObject -- Provide entry/exit guards for object critical regions.

Synopsis


    #include <CGaurdedObject.h>
        CGaurdedObject
      
  CGaurdedObject()
          throws ;
     
  void Enter();
       void Leave();
   

DESCRIPTION

This is a base class intended for objects that require entry and exit synchronization gaurds for object wide critical regions.

METHODS

CGaurdedObject() throws ;

Default constructor of the base class. This creates and initializes the mutex that will be used to synchronize across threads.

Note that there is no public copy constructor for this class and therefore objects which extend this base class cannot, in practice be copy constructed.

void Enter();

Called to enter a critical region. Only one thread at a time can be executing in the object past a call to Enter. This makes critical regions object wide.

void Leave();

Called to leave a critical region. If there are threads blocked in a call to Enter (on any method in this object), one is selected to resume execution (at the mercy of the scheduler).