15 Barrier::Barrier(
int threads) noexcept : _counter(threads), _generation(0), _threads(threads)
17 assert((threads > 0) &&
"Barrier threads counter must be greater than zero!");
22 std::unique_lock<std::mutex> lock(_mutex);
25 int generation = _generation;
44 _cond.wait(lock, [&,
this]() {
return generation != _generation; });
Barrier synchronization primitive definition.
Barrier(int threads) noexcept
Default class constructor.
bool Wait() noexcept
Wait at the barrier until all other threads reach this barrier.
C++ Benchmark project definitions.