Nebula
Loading...
Searching...
No Matches
Win32::Win32ThreadBarrier Class Reference

#include <win32threadbarrier.h>

Detailed Description

Block until all thread have arrived at the barrier.

Public Member Functions

 Win32ThreadBarrier ()
 constructor
 
 ~Win32ThreadBarrier ()
 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
 

Private Attributes

Threading::CriticalSection critSect
 
long numThreads
 
volatile long outstandingThreads
 
HANDLE event
 
bool isValid
 

Constructor & Destructor Documentation

◆ Win32ThreadBarrier()

Win32::Win32ThreadBarrier::Win32ThreadBarrier ( )
inline

constructor

◆ ~Win32ThreadBarrier()

Win32::Win32ThreadBarrier::~Win32ThreadBarrier ( )
inline

destructor

Member Function Documentation

◆ Arrive()

bool Win32::Win32ThreadBarrier::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.

◆ IsValid()

bool Win32::Win32ThreadBarrier::IsValid ( ) const
inline

return true if the object has been setup

◆ Setup()

void Win32::Win32ThreadBarrier::Setup ( SizeT numThreads)
inline

setup the object with the number of threads

◆ SignalContinue()

void Win32::Win32ThreadBarrier::SignalContinue ( )
inline

call after Arrive() returns true to resume all threads

This method should be called after Arrive() returns true.

This means that all threads have arrived at the sync point and execution of all threads may resume.

◆ Wait()

void Win32::Win32ThreadBarrier::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.

Member Data Documentation

◆ critSect

Threading::CriticalSection Win32::Win32ThreadBarrier::critSect
private

◆ event

HANDLE Win32::Win32ThreadBarrier::event
private

◆ isValid

bool Win32::Win32ThreadBarrier::isValid
private

◆ numThreads

long Win32::Win32ThreadBarrier::numThreads
private

◆ outstandingThreads

volatile long Win32::Win32ThreadBarrier::outstandingThreads
private

The documentation for this class was generated from the following file: