cpp/thread/latch

The class is a downward counter of type std which can be used to synchronize threads. The value of the counter is initialized on creation. Threads may block on the latch until the counter is decremented to zero. There is no possibility to increase or reset the counter, which makes the latch a single-use barrier.

Concurrent invocations of the member functions of, except for the destructor, do not introduce data races.

Unlike std, can be decremented by a participating thread more than once.