This is a rather simple class that encapsulates the Win32 CriticalSection operations. It is used for Classics' own mutual exclusion needs, and is useful for simple cases. Contrast with the facilities of the Conquer library, which are more elaborate.

The constructor and destructor take care of housekeeping, as expected. Available members are:

Which simply call the underlying Win32 primitive.

Using the critical_section in a prodedural manner like this is not recomended. Instead, use the critical_section::locker object, which provides for locking in the constructor and unlocking in its destructor. This way it is less error prone and is exception safe.