Representation of a critical section. More...
#include <ogdf/basic/CriticalSection.h>
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. | |
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.
| ogdf::CriticalSection::CriticalSection | ( | ) | [inline] |
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.
Definition at line 84 of file CriticalSection.h.
| ogdf::CriticalSection::~CriticalSection | ( | ) | [inline] |
Definition at line 88 of file CriticalSection.h.
| 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.
| bool ogdf::CriticalSection::tryEnter | ( | ) | [inline] |
Tries to enter the critical section; returns true on success.
Definition at line 98 of file CriticalSection.h.
CRITICAL_SECTION ogdf::CriticalSection::m_cs [private] |
The Windows critical section object.
Definition at line 108 of file CriticalSection.h.