Last Updated: June 6, 2026
CountDownLatch is a one-shot gate. You build it with a number, threads decrement that number, and any thread waiting on the latch is held until the number reaches zero. Once the count hits zero, the gate opens and stays open, every waiter wakes up, and the latch is done. You cannot rewind it. You cannot reuse it. This lesson covers what the latch is, the two classic patterns it solves (releasing many workers at once, or waiting for many workers to finish), how to handle errors so a missed countDown doesn't hang await forever, and the timed variant await(timeout, unit) for when you don't trust the work to ever complete.
A Semaphore controls how many threads can be inside a section at the same time. The latch is a different shape. It doesn't gate access to anything. It gates time: nobody passes the gate until a counted set of events has happened.