IT lexicon › Programming › Countdown latch

Countdown latch

Programming På svenska → Updated: 2026-11-16

One-shot synchronization where one or more threads block until a counter reaches zero.

A countdown latch starts with an initial count. One or more threads call await() and park; other threads each call countDown() to decrement the counter. When it hits zero, all waiting threads are released. Unlike cyclic barrier, it's single-use—once it fires, it stays open. Common pattern: main thread spins up N background jobs, each signals done by calling countDown(), and main waits on the latch until all jobs finish.

Java introduced it in java.util.concurrent 2004. It's simpler than manual locking for the "wait for N things to finish" pattern, and appears in nearly every concurrent library since.

← Back to the lexicon