# CWhileInCS Class Reference
[MCCore]

Inheritance diagram for CWhileInCS:

List of all members.

## Public Member Functions
| CWhileInCS (TMCCriticalSection *theCS)
| ~CWhileInCS ()
void | Clean ()
## Protected Attributes
TMCCriticalSection * | fCS

## Detailed Description

This class should be used to declare a local variable. The life span of this variable determines what block of code is encapsulated in the critical section. For more information on critical region see TMCCriticalSection.

One of the advantage of using a local variable is that the destructor is called if an exception is thrown or if return is called in the middle of the function

For instance, you could write:

     {
       CWhileInCS cs(criticalSection);

       // Code excuted inside the critical section
       ...
     }
     // Code excuted outside the critical section
     ...

## Constructor & Destructor Documentation

CWhileInCS::CWhileInCS | ( | TMCCriticalSection * | theCS | ) | `[inline]`

CWhileInCS::~CWhileInCS | ( |  | ) | `[inline]`

## Member Function Documentation

void CWhileInCS::Clean | ( |  | ) | `[inline]`

## Member Data Documentation

TMCCriticalSection* CWhileInCS::fCS`[protected]`

The documentation for this class was generated from the following file:

- MCSMPCriticalSection.h