# CWhileInSharedCS Class Reference
[MCCore]

Inheritance diagram for CWhileInSharedCS:

List of all members.

## Public Member Functions
| CWhileInSharedCS (TMCSharedCriticalSection &theCS)
| ~CWhileInSharedCS ()
void | Clean ()
## Protected Attributes
TMCSharedCriticalSection * | fCS
## Friends
class | CWhileInSharedExclusiveCS

## 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 in shared access mode. For more information on critical region see TMCSharedCriticalSection.

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:

     {
       CWhileInSharedCS cs(criticalSection);

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

## Constructor & Destructor Documentation

CWhileInSharedCS::CWhileInSharedCS | ( | TMCSharedCriticalSection & | theCS | ) | `[inline]`

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

## Member Function Documentation

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

## Friends And Related Function Documentation

friend class CWhileInSharedExclusiveCS`[friend]`

## Member Data Documentation

TMCSharedCriticalSection* CWhileInSharedCS::fCS`[protected]`

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

- MCSMPSharedCriticalSection.h