CCriticalSection Class Reference

#include <mutex.H>

Inheritance diagram for CCriticalSection:

Inheritance graph
[legend]
Collaboration diagram for CCriticalSection:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void enter ()
 enter the critical section (it is also allowed to enter when already inside)
bool try_enter ()
 try to enter the critical section and return result
void leave ()
 leave the critical section (it is also allowed to leave without being inside)
 CCriticalSection (CCriticalSection::Mutex &crit_sect_mutex, const bool enter_now=true)
 constructor: attach mutex to handle critical sections, also (by default): enter the critical section
 ~CCriticalSection ()
 destructor: if we were inside the critical section: leave the critical section

Private Attributes

Mutexmutex
bool inside

Classes

class  Mutex


Detailed Description

An instance of this class can be used to define a block as a critical section which is locked by a given mutex:

It is also a good idea to use this class in conjunction with exception handling, because the traditional way of locking and unlocking a mutex may introduce severe problems, if exceptions are thrown and the state of a mutex is left undefined. (Destructors are called regardless whether the block is left with or without a throwing an exception, so the state of the mutex remains always well defined.)

Definition at line 154 of file mutex.H.


Constructor & Destructor Documentation

CCriticalSection::CCriticalSection ( CCriticalSection::Mutex crit_sect_mutex,
const bool  enter_now = true 
) [inline]

constructor: attach mutex to handle critical sections, also (by default): enter the critical section

Definition at line 199 of file mutex.H.

CCriticalSection::~CCriticalSection (  )  [inline]

destructor: if we were inside the critical section: leave the critical section

Definition at line 206 of file mutex.H.


Member Function Documentation

void CCriticalSection::enter (  )  [inline]

enter the critical section (it is also allowed to enter when already inside)

Definition at line 169 of file mutex.H.

Referenced by StaticRelations::insert(), and Cprocess_clients::process_data_stream().

bool CCriticalSection::try_enter (  )  [inline]

try to enter the critical section and return result

Definition at line 179 of file mutex.H.

Referenced by StaticRelations::insert(), Cprocess_clients::process_data_stream(), and Cprocess_clients::seek_emergency_handler().

void CCriticalSection::leave (  )  [inline]

leave the critical section (it is also allowed to leave without being inside)

Definition at line 189 of file mutex.H.

Referenced by StaticRelations::insert(), Cprocess_clients::process_data_stream(), and Cprocess_clients::seek_emergency_handler().


Member Data Documentation

Mutex& CCriticalSection::mutex [private]

Definition at line 163 of file mutex.H.

bool CCriticalSection::inside [private]

Definition at line 164 of file mutex.H.


The documentation for this class was generated from the following file:
Generated on Wed Nov 7 23:30:45 2007 for Qsieve by  doxygen 1.5.4