Open
Graph Drawing
Framework

 v.2012.05
 

ogdf::CriticalSection Class Reference

Representation of a critical section. More...

#include <ogdf/basic/CriticalSection.h>

List of all members.

Public Member Functions

 CriticalSection ()
 Creates a critical section object.
 CriticalSection (int spinCount)
 Creates a critical section object with spin count.
 ~CriticalSection ()
void enter ()
 Enters the critical section.
bool tryEnter ()
 Tries to enter the critical section; returns true on success.
void leave ()
 Leaves the critical section.

Private Attributes

CRITICAL_SECTION m_cs
 The Windows critical section object.

Detailed Description

Representation of a critical section.

Critical sections are used to synchronize access to resources shared by several threads. It can be used to protect an object or a piece of code allowing always one thread at a time access.

Definition at line 69 of file CriticalSection.h.


Constructor & Destructor Documentation

Creates a critical section object.

Definition at line 73 of file CriticalSection.h.

ogdf::CriticalSection::CriticalSection ( int  spinCount) [inline, explicit]

Creates a critical section object with spin count.

The spin count determines how many times the calling thread spins when the critical section is unavailable, before it performs a wait.

Remarks:
The spin count is only used on multiprocessor systems; otherwise it makes no sense.

Definition at line 84 of file CriticalSection.h.

Definition at line 88 of file CriticalSection.h.


Member Function Documentation

void ogdf::CriticalSection::enter ( ) [inline]

Enters the critical section.

Definition at line 93 of file CriticalSection.h.

void ogdf::CriticalSection::leave ( ) [inline]

Leaves the critical section.

Definition at line 103 of file CriticalSection.h.

Tries to enter the critical section; returns true on success.

Definition at line 98 of file CriticalSection.h.


Member Data Documentation

CRITICAL_SECTION ogdf::CriticalSection::m_cs [private]

The Windows critical section object.

Definition at line 108 of file CriticalSection.h.


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