This package implements a multithreading primitive called a
CountDownLatch that holds an internal count.
The latch's count can be decremented by multiple threads.
Threads may also wait on the latch's count to become zero.
In this example, the main thread will be blocked by
await until the spawned thread counts the latch down.
This is clearly a contrived example, but imagine that there is much more code before
count_down and before
latch = CountDownLatch(1) Threads.@spawn begin # Decrease the latch's count by one count_down(latch) end # Wait until the latch's count become zero await(latch)