CppBenchmark  1.0.4.0
C++ Benchmark Library
Public Member Functions | List of all members
CppBenchmark::Barrier Class Reference

Barrier synchronization primitive. More...

#include <barrier.h>

Public Member Functions

 Barrier (int threads) noexcept
 Default class constructor. More...
 
 Barrier (const Barrier &)=delete
 
 Barrier (Barrier &&)=delete
 
 ~Barrier ()=default
 
Barrieroperator= (const Barrier &)=delete
 
Barrieroperator= (Barrier &&)=delete
 
bool Wait () noexcept
 Wait at the barrier until all other threads reach this barrier. More...
 

Detailed Description

Barrier synchronization primitive.

A barrier for a group of threads in the source code means any thread must stop at this point and cannot proceed until all other threads reach this barrier.

Thread-safe.

https://en.wikipedia.org/wiki/Barrier_(computer_science)

Definition at line 26 of file barrier.h.

Constructor & Destructor Documentation

◆ Barrier() [1/3]

CppBenchmark::Barrier::Barrier ( int  threads)
explicitnoexcept

Default class constructor.

Parameters
threads- Count of threads to wait at the barrier

Definition at line 15 of file barrier.cpp.

◆ Barrier() [2/3]

CppBenchmark::Barrier::Barrier ( const Barrier )
delete

◆ Barrier() [3/3]

CppBenchmark::Barrier::Barrier ( Barrier &&  )
delete

◆ ~Barrier()

CppBenchmark::Barrier::~Barrier ( )
default

Member Function Documentation

◆ operator=() [1/2]

Barrier& CppBenchmark::Barrier::operator= ( Barrier &&  )
delete

◆ operator=() [2/2]

Barrier& CppBenchmark::Barrier::operator= ( const Barrier )
delete

◆ Wait()

bool CppBenchmark::Barrier::Wait ( )
noexcept

Wait at the barrier until all other threads reach this barrier.

Will block.

Returns
'true' for the last thread that reach barrier, 'false' for each of the remaining threads

Definition at line 20 of file barrier.cpp.


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