System.SyncObjs.TConditionVariableCS
Delphi
TConditionVariableCS = class(TSynchroObject)
C++
class PASCALIMPLEMENTATION TConditionVariableCS : public TSynchroObject
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
class | public | System.SyncObjs.pas System.SyncObjs.hpp |
System.SyncObjs | System.SyncObjs |
Description
TConditionVariableCS allows the use of condition variables in combination with critical sections.
Use TConditionVariableCS in multi-threaded applications in which a thread is required to sleep, inside its critical section, until a specified condition becomes true. During this waiting period, other threads are able to run and are supposed to notify the sleeping thread when the condition becomes true.
When the condition variable is awakened, the critical section is automatically reacquired.
To create a condition variable, instantiate the TConditionVariableCS class. Then, in the executing code of each thread, use a combination of WaitFor and the Release or ReleaseAll methods in order to achieve the communication between threads.