Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

TSE3::Impl::CritSec Class Reference

Convenient API for Mutex class. More...

#include <Mutex.h>

List of all members.

Public Member Functions

 CritSec ()
 ~CritSec ()


Detailed Description

Convenient API for Mutex class.

A 'critical section' class that provides a somewhat more convenient interface to the Mutex class. A CritSec object simply locks the global Mutex upon creation and unlocks it on destruction.

Therefore, this means that rather than write:

{ TSE3::Impl::Mutex::mutex()->lock(); // do something TSE3::Impl::Mutex::mutex()->unlock(); }

You can simply write:

{ TSE3::Impl::CritSec cs; // do something }

Clearly, this prevents a possible source of error, where you might forget to unlock the mutex after having locked it. It is also in most cases a lot more convenient to use.

The CritSec class is small, simple and implemented with inline functions so the resultant generated code for both of the above examples is identical.

Author:
Pete Goodliffe
Version:
3.00
See also:
Mutex


Constructor & Destructor Documentation

TSE3::Impl::CritSec::CritSec  )  [inline]
 

TSE3::Impl::CritSec::~CritSec  )  [inline]
 


The documentation for this class was generated from the following file:
Generated on Wed May 25 14:48:00 2005 for TSE3 by doxygen 1.3.2