CriticalSection Class Reference

Class to ensure serialized access to resources shared among several threads. More...

List of all members.

Public Member Functions

 CriticalSection ()
 Initializes critical section thread semantics.
bool isLocked ()
 Checks if object is locked.
void lock ()
 Lock the section.
void unlock ()
 Unlocks the section.


Detailed Description

Class to ensure serialized access to resources shared among several threads.

Use this class to ensure serialized access to objects shared among multiple threads. To use instantiate and call lock which will deny other executing threads to be able to return after calling lock before the first thread have called unlock.
Related classes and functions.


Member Function Documentation

bool isLocked (  ) 

Checks if object is locked.

Returns true if somebody have aquired a lock on the object

void lock (  ) 

Lock the section.

Only the first thread calling lock will return immediately, all other threads calling lock will be HALTED until the first thread have called unlock on the object.

void unlock (  ) 

Unlocks the section.

No other thread will be able to return after calling lock until the thread who first called lock on the object have called unlock on the object.

Back to SmartWin website
SourceForge.net Logo