MeVisLab Toolbox Reference
ml::Barrier Class Reference

A barrier class that handles synchronization of multiple threads Thread-safety: This class is thread-safe. More...

#include <mlBarrier.h>

Public Member Functions

 Barrier (unsigned int count=0)
 Creates a barrier with initial count of threads to synchronize. More...
 
void setNumberOfThreads (unsigned int count)
 Sets the number of threads that should synchronize with the wait call. More...
 
bool wait ()
 Waits for other threads to also wait. More...
 

Detailed Description

A barrier class that handles synchronization of multiple threads Thread-safety: This class is thread-safe.

Definition at line 31 of file mlBarrier.h.

Constructor & Destructor Documentation

◆ Barrier()

ml::Barrier::Barrier ( unsigned int  count = 0)

Creates a barrier with initial count of threads to synchronize.

Member Function Documentation

◆ setNumberOfThreads()

void ml::Barrier::setNumberOfThreads ( unsigned int  count)

Sets the number of threads that should synchronize with the wait call.

Note: only set this when no threads are currently waiting for synchronization!

◆ wait()

bool ml::Barrier::wait ( )

Waits for other threads to also wait.

Returns true for the thread that calls wait as last caller.


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