CountdownLatch

vault class CountdownLatch

A CountdownLatch is a kind of barrier that completes a future when signaled a predetermined number of times.

CountdownLatch is in the Prelude, meaning it is always available and does not need to be imported.

API Reference

Constructors

new(initialValue: int)

Constructs a new CountdownLatch with the counter initialized to the given value.

Methods

signal() -> void

Decrements the counter by one. If the counter reaches zero, the Fut returned by getFut() is completed.


getFut() -> Fut<void>

Returns the future associated with this CountdownLatch. This function always returns the same future, i.e., it is idempotent.


join() -> void 🛑

Blocks until the future returned by getFut() is completed.

Blocking functions are only allowed in the entry function.