tmc::barrier#

An async version of std::barrier.

API Reference#

class barrier#

Similar semantics to std::barrier, although it only exposes one operation - co_await is equivalent to std::barrier::arrive_and_wait. Like std::barrier, the count will be automatically reset after all awaiters arrive, and it may be reused afterward.

Public Functions

inline barrier(size_t Count) noexcept#

Sets the number of awaiters for the barrier. Setting this to zero or a negative number will cause awaiters to resume immediately.

inline aw_barrier operator co_await() noexcept#

Equivalent to std::barrier::arrive_and_wait. Decrements the counter, and if the counter reaches 0, wakes all awaiters, and resets the counter to the original maximum as specified in the constructor. Otherwise, suspends until Count awaiters have reached this point.

~barrier()#

On destruction, any awaiters will be resumed.