chsvlib
chsv helper source code
latch Class Reference

Implements a single-use barrier synchronization. More...

#include <chsvthrd.h>

Public Member Functions

 latch (std::ptrdiff_t count)
 Constructs a latch for synchronizing the specified number of threads. More...
 
 latch (const latch &)=delete
 Latches are not MoveConstructible.
 
latchoperator= (const latch &)=delete
 Latches are not MoveAssignable.
 
void count_down (std::ptrdiff_t n=1) noexcept
 Decrements a number of threads to wait for arrival to the synchronization points by a specified number. More...
 
bool try_wait () const noexcept
 Tests whether the latch is open without blocking the caller or modifying the latch. More...
 
void wait () const
 Blocks the calling thread until the latch is opened.
 
void arrive_and_wait (std::ptrdiff_t n=1)
 Releases the latch by a specified number of threads and blocks the caller until the latch is opened. More...
 

Static Public Member Functions

static constexpr std::ptrdiff_t() max () noexcept
 

Detailed Description

Implements a single-use barrier synchronization.

Implements a C++20 std::latch interface using C++14.

The reusable barrier is implemented by the barrier class.

Examples
chsvthrd\barrier_test.cpp.

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