![]() |
Arene Base
Fundamental Utilities For Safety Critical C++
|
A backport of std::barrier from C++20.
More...
Public Member Functions | |
| barrier (barrier &&)=delete | |
| Not movable. | |
| barrier (barrier const &)=delete | |
| Not copyable. | |
| template<typename F = CompletionFunction, constraints< std::enable_if_t< std::is_default_constructible< F >::value > > = nullptr> | |
| constexpr | barrier (std::ptrdiff_t count) noexcept(std::is_nothrow_default_constructible< F >::value) |
| Construct a barrier with a specified count and default-constructed completion function. | |
| constexpr | barrier (std::ptrdiff_t count, CompletionFunction func) noexcept(std::is_nothrow_move_constructible< CompletionFunction >::value) |
| Construct a barrier with a specified count and completion function. | |
| ~barrier ()=default | |
| Default destructor. | |
| ARENE_NODISCARD auto | arrive () -> arrival_token |
| Arrive at the barrier, and obtain a token that can be used to wait for the end of the completion step associated with the current phase. | |
| ARENE_NODISCARD auto | arrive (std::ptrdiff_t arrivals) -> arrival_token |
| Arrive at the barrier with the specified number of arrivals, and obtain a token that can be used to wait for the end of the completion step associated with the current phase. | |
| void | arrive_and_drop () |
| Decrease the number of arrivals required for the subsequent phases to end, and arrive at the barrier. May trigger the completion step. If the required number of arrivals is reduced to zero then the barrier has no more completion phases. | |
| void | arrive_and_wait () |
| Arrive at the barrier and wait for the completion step to end. May trigger the completion step. | |
| auto | operator= (barrier &&) -> barrier &=delete |
| Not movable. | |
| auto | operator= (barrier const &) -> barrier &=delete |
| Not copyable. | |
| void | wait (arrival_token token) |
Wait for the completion step associated with the phase identified by token to end. | |
Static Public Member Functions | |
| static constexpr auto | max () noexcept -> std::ptrdiff_t |
| Get the maximum supported count. | |
A backport of std::barrier from C++20.
| CompletionFunction | The type of the completion function. Defaults to an invocable type with a do-nothing function call operator. |
CompletionFunction must be destructible, move-constructible and nothrow-invocable.
|
inlineconstexprnoexcept |
Construct a barrier with a specified count and completion function.
| count | The initial number of arrivals required to complete each phase |
| func | The completion function to invoke at the end of each phase |
|
inlineexplicitconstexprnoexcept |
Construct a barrier with a specified count and default-constructed completion function.
| count | The initial number of arrivals required to complete each phase |
|
default |
Default destructor.
|
delete |
Not copyable.
|
delete |
Not movable.
|
inline |
Arrive at the barrier, and obtain a token that can be used to wait for the end of the completion step associated with the current phase.
arrival_token associated with the current phase
|
inline |
Arrive at the barrier with the specified number of arrivals, and obtain a token that can be used to wait for the end of the completion step associated with the current phase.
| arrivals | The number of arrivals |
arrival_token associated with the current phase arrivals must be greater than zero, and less than or equal to the remaining number of arrivals required in the current phase.
|
inline |
Decrease the number of arrivals required for the subsequent phases to end, and arrive at the barrier. May trigger the completion step. If the required number of arrivals is reduced to zero then the barrier has no more completion phases.
|
inline |
Arrive at the barrier and wait for the completion step to end. May trigger the completion step.
|
inlinestaticconstexprnoexcept |
Get the maximum supported count.
|
delete |
Not movable.
|
delete |
Not copyable.
|
inline |
Wait for the completion step associated with the phase identified by token to end.
| token | A token returned from arrive |
token must be associated with the current phase, or the previous one.