std::latch

Get detailed information on std::latch.

Now, let us have a closer look at the interface of a std::latch.

Member function Description
lat.count_down(upd = 1) Atomically decrements the counter by upd without blocking the caller.
lat.try_wait() Returns true if counter == 0.
lat.wait() Returns immediately if counter == 0. If not blocks until counter == 0.
lat.arrive_and_wait(upd = 1) Equivalent to count_down(upd); wait();.

Get hands-on with 1200+ tech skills courses.