class Concurrent::CountDownLatch
@!macro count_down_latch
A synchronization object that allows one thread to wait on multiple other threads. The thread that will wait creates a `CountDownLatch` and sets the initial value (normally equal to the number of other threads). The initiating thread passes the latch to the other threads then waits for the other threads by calling the `#wait` method. Each of the other threads calls `#count_down` when done with its work. When the latch counter reaches zero the waiting thread is unblocked and continues with its work. A `CountDownLatch` can be used only once. Its value cannot be reset.
@!macro count_down_latch_public_api @example Waiter and Decrementer
latch = Concurrent::CountDownLatch.new(3) waiter = Thread.new do latch.wait() puts ("Waiter released") end decrementer = Thread.new do sleep(1) latch.count_down puts latch.count sleep(1) latch.count_down puts latch.count sleep(1) latch.count_down puts latch.count end [waiter, decrementer].each(&:join)