Win360::Win360ThreadBarrier Class Reference
#include <win360threadbarrier.h>
Inheritance diagram for Win360::Win360ThreadBarrier:
Detailed Description
Block until all thread have arrived at the barrier.(C) 2009 Radon Labs GmbH
Public Member Functions | |
Win360ThreadBarrier () | |
constructor | |
~Win360ThreadBarrier () | |
destructor | |
void | Setup (SizeT numThreads) |
setup the object with the number of threads | |
bool | IsValid () const |
return true if the object has been setup | |
bool | Arrive () |
enter thread barrier, return false if not all threads have arrived yet | |
void | Wait () |
call after Arrive() returns false to wait for other threads | |
void | SignalContinue () |
call after Arrive() returns true to resume all threads |
Member Function Documentation
bool Win360::Win360ThreadBarrier::Arrive | ( | ) | [inline] |
enter thread barrier, return false if not all threads have arrived yet
Notify arrival at thread-sync point, return false if not all threads have arrived yet, and true if all threads have arrived. If the method returns false, you should immediately call Wait(), if the method returns true, the caller has a chance to perform some actions which should happen before threads continue, and then call the SignalContinue() method.
void Win360::Win360ThreadBarrier::Wait | ( | ) | [inline] |
call after Arrive() returns false to wait for other threads
This method should be called when Arrive() returns false. It will put the thread to sleep because not all threads have arrived yet. When the method returns, all threads have arrived at the sync point.
NOTE: sometimes both the render and the main thread arrive here with the outstandingThreads member set to 1 (from two) causing both thread to be waiting idefinitely.
void Win360::Win360ThreadBarrier::SignalContinue | ( | ) | [inline] |