Skip to content

crelte / std/sync / Barrier

Class: Barrier<T> ​

A class to help make async code execute at the same time.

Making sure all participants are ready before continuing.

Type Parameters ​

T ​

T

Constructors ​

Constructor ​

ts
new Barrier<T>(): Barrier<T>;

Returns ​

Barrier<T>

Methods ​

add() ​

ts
add(): BarrierAction<T>;

Add yourself to the barrier

Only if all participants call ready the barrier is opened.

Returns ​

BarrierAction<T>

Throws ​

if the barrier is already open


isOpen() ​

ts
isOpen(): boolean;

Returns true if the barrier is already opened meaning the add function would panic

Returns ​

boolean