15 assert((threads > 0) &&
"Latch threads counter must be greater than zero!");
17 std::scoped_lock lock(_mutex);
44 std::unique_lock<std::mutex> lock(_mutex);
52 std::unique_lock<std::mutex> lock(_mutex);
55 int generation = _generation;
62 _cond.wait(lock, [&,
this]() {
return generation != _generation; });
67 std::unique_lock<std::mutex> lock(_mutex);
74 int generation = _generation;
77 _cond.wait(lock, [&,
this]() {
return generation != _generation; });
82 std::unique_lock<std::mutex> lock(_mutex);
85 return (_threads == 0);
void Reset(int threads) noexcept
Reset the latch with a new threads counter value.
bool TryWait() noexcept
Try to wait for the latch without block.
void CountDown() noexcept
Countdown the latch.
void CountDownAndWait() noexcept
Countdown the latch.
void Wait() noexcept
Wait for the latch.
Latch synchronization primitive definition.
C++ Common project definitions.