Implements a reusable barrier synchronization primitive. More...
#include <chsvthrd.h>
Public Types | |
typedef unsigned | arrival_token |
Public Member Functions | |
barrier (std::ptrdiff_t count, CompletionFunction on_completion=CompletionFunction()) noexcept | |
Constructs a barrier associated with a specified number of threads to wait at synchronization points and optionally with a specified completion routine. More... | |
barrier (const barrier &)=delete | |
Barriers are not MoveConstructible. | |
barrier & | operator= (const barrier &)=delete |
Barriers are not MoveAssignable. | |
arrival_token | arrive (std::ptrdiff_t n=1) |
Implements arrival of a specified number of threads to the barrier. More... | |
void | wait (arrival_token arrival) const |
Blocks the calling thread until the barrier, in the specified synchronization phase, opens. More... | |
void | arrive_and_wait () |
Implements arrival of a thread to the barrier and blocking wait for opening of the barrier. More... | |
void | arrive_and_drop () |
Implements arrival of a thread to the barrier, blocking wait of the calling thread for opening of the barrier and decrement of the number of threads the barrier can be used to synchronize in subsequent phases. | |
Static Public Member Functions | |
static constexpr std::ptrdiff_t() | max () noexcept |
Implements a reusable barrier synchronization primitive.
CompletionFunction | Specifies a class implementing functional objects called without parameters upon opening of barriers. The default functional object is barrier_default_completion which performs no actions. |
Implements a C++20 std::barrier interface using C++14.
A single-use barrier is also implemented by the latch class.