CCriticalSection Class Reference
[Win32 Synchronization primitives]

Inheritance diagram for CCriticalSection:

Inheritance graph
[legend]
Collaboration diagram for CCriticalSection:

Collaboration graph
[legend]

List of all members.


Detailed Description

A class that wraps the operating system Critical Section API and that implements the ICriticalSection interface. The addition of the ICriticalSection interface has increased the size of this object and added a layer of indirection into the Enter() and Leave() calls. If this proves to be a performance problem then we can simply create a 'CSmallAndFastCriticalSection which doesn't inherit from the interface.


Public Member Functions

 CCriticalSection ()
 Creates a critical section object.
 CCriticalSection (const DWORD spinCount)
 Creates a critical section object and allows you to specify the spin count.
 ~CCriticalSection ()
void SetSpinCount (const DWORD spinCount)
virtual bool TryEnter ()
 Try to enter the critical section and lock other threads outside, returns true if successful and false if some other thread already has the critical section locked1.
virtual void Enter ()
 Enter the critical section and lock other threads outside.
virtual void Leave ()
 Leave the critical section and allow another thread to enter.


Constructor & Destructor Documentation

CCriticalSection (  ) 

Creates a critical section object.

CCriticalSection ( const DWORD  spinCount  )  [explicit]

Creates a critical section object and allows you to specify the spin count.

~CCriticalSection (  ) 


Member Function Documentation

void SetSpinCount ( const DWORD  spinCount  ) 

bool TryEnter (  )  [virtual]

Try to enter the critical section and lock other threads outside, returns true if successful and false if some other thread already has the critical section locked1.

Implements ICriticalSection.

void Enter (  )  [virtual]

Enter the critical section and lock other threads outside.

Implements ICriticalSection.

void Leave (  )  [virtual]

Leave the critical section and allow another thread to enter.

Implements ICriticalSection.


Generated on Mon Sep 7 14:10:11 2009 for JetByte Socket Tools - v6.1 by  doxygen 1.5.3