RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TConditionVariableCS Class

TConditionVariableCS allows the use of condition variables in combination with critical sections.

Pascal
TConditionVariableCS = class(TSynchroObject);
C++
class TConditionVariableCS : public TSynchroObject;

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. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!