Class: Concurrent::CountDownLatch
- Inherits:
-
PureCountDownLatch
- Object
- Synchronization::Object
- PureCountDownLatch
- Concurrent::CountDownLatch
- Defined in:
- lib/concurrent/atomic/count_down_latch.rb,
lib/concurrent/atomic/count_down_latch.rb
Overview
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.