# FoundationClasses
TKernel
Standard

# Standard_Mutex::SentryNested Class Reference

Advanced Sentry class providing convenient interface to manipulate a mutex from one thread. More...

`#include <Standard_Mutex.hxx>`

## Public Member Functions

| SentryNested (Standard_Mutex &theMutex, Standard_Boolean doLock=Standard_True)
| Constructor - initializes the sentry object by reference to a mutex (which must be initialized). Locks the mutex immediately unless Standard_False is given as second argument.
| ~SentryNested ()
| Destructor - unlocks the mutex if already locked.
void | Lock ()
| Lock the mutex.
void | Unlock ()
| Unlock the mutex.

## Private Attributes

Standard_Mutex & | myMutex
Standard_Boolean | nbLocked
| Note that we do not protect this field from concurrent access, as it should always be accessed from within one thread, i.e. synchronously.

## Detailed Description

As compared with simple Sentry class, provides possibility to lock and unlock mutex at any moment, and perform nested lock/unlock actions (using lock counter). However all calls must be from within the same thread; this is to be ensured by the code using this class.

## Constructor & Destructor Documentation

Standard_Mutex::SentryNested::SentryNested | ( | Standard_Mutex & | theMutex,
|  | Standard_Boolean | doLock = `Standard_True`
| ) | `[inline]`

Standard_Mutex::SentryNested::~SentryNested | ( |  | ) | `[inline]`

## Member Function Documentation

void Standard_Mutex::SentryNested::Lock | ( |  | ) | `[inline]`

void Standard_Mutex::SentryNested::Unlock | ( |  | ) | `[inline]`

## Field Documentation

Standard_Mutex& Standard_Mutex::SentryNested::myMutex `[private]`

Standard_Boolean Standard_Mutex::SentryNested::nbLocked `[private]`

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

- Standard_Mutex.hxx