v2026.11.2
All Bundles
Bundle

System support for threads and runtime concurrency

CountDownLatch

One-shot countdown latch: threads wait in Await until CountDown has been called the given number of times. Once the count reaches zero it stays there, and Await returns at once.

Example

latch := CountDownLatch->New(2);
latch->CountDown();
latch->GetCount()->PrintLine(); # 1
latch->CountDown();
latch->Await(); # returns at once: the count is 0

Operations

Await #

Waits until the count reaches zero

method : public : Await() ~ Nil

CountDown #

Lowers the count by one, releasing every waiting thread when it reaches zero

method : public : CountDown() ~ Nil

GetCount #

The count still to go

method : public : GetCount() ~ Int

Return

TypeDescription
Intremaining count

New # constructor

Creates a latch

New(count:Int)

Parameters

NameTypeDescription
countIntnumber of CountDown calls that release the waiting threads