Count-down latches


The concurrency.count-downs vocabulary implements the count-down latch data type, which is a wrapper for a non-negative integer value which tends towards zero. A thread can either decrement the value, or wait for it to become zero.
<count-down> ( n -- count-down )

count-down ( count-down -- )

await ( count-down -- )

await-timeout ( count-down timeout -- )


The vocabulary was modeled after a similar feature in Java's java.util.concurrent library.