Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site











SourceForge.net Logo

ConditionVariable

 

class ConditionVariable

ConditionVariable allows threads to suspend execution (using Wait) until they are awaken by another thread (using Signal or Broadcast methods). ConditionVariable has associated Mutex to avoid possible race conditions when entering suspended state.

 

 

Public Method List

 

void Wait(Mutex& m)

Atomically unlocks m and starts waiting for Signal or Broadcast. m has to be owned by calling thread before invoking. When Signal or Broadcast are received, resumes execution and reacquires m.

 


 

void Signal()

Resumes execution of single waiting thread, if any.

 


 

void Broadcast()

Resumes execution of all currently waiting threads.

 

 

 

 

StaticConditionVariable

 

class StaticConditionVariable

Variant of ConditionVariable that can be used as static or global variable without the need of initialization  - it has no constructor and correctly performs the first initialization when any of methods is called. That avoids problems with initialization order or multithreaded initialization issues.

 

 

Public Method List

 

ConditionVariable& Get()

operator ConditionVariable&()

Returns the instance of ConditionVariable.

 


 

void Wait(Mutex& m)

void Signal()

void Broadcast()

Calls respective ConditionVariable methods.

 

 

Last edit by cxl on 12/02/2017. Do you want to contribute?. T++