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. |
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.
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.