Await_sync.Countdown_latchA poisonable one-shot countdown latch.
A Countdown_latch.t is a synchronization aid that allows one or more threads to wait until a number of operations being performed in other threads complete.
A countdown latch is initialized with a count. The await method blocks until a call to decr decrements the count to zero, after which all waiting threads are released. A countdown latch is one-shot -- the count cannot be changed after it reaches zero. If you need a version that resets the count, consider using a Barrier instead, though note that with a barrier the only operation available is waiting - it is not possible to decrement without blocking.
val sexp_of_t : t -> Sexplib0.Sexp.tval max_count : Base.int @@ portablemax_count is the maximum allowed count for a countdown latch.
create n returns a new countdown latch with its count initialized to n.
The optional padded argument specifies whether to pad the data structure to avoid false sharing. See Atomic.make for a longer explanation.
count t returns the current count of the countdown latch t.
poison t marks the countdown latch as poisoned. Concurrent and subsequent calls to await, await_or_cancel, and incr will raise the Poisoned exception.
is_poisoned t determines whether the countdown latch has been poisoned.
incr t increments the count of the countdown latch t.
The count is not logically modified after it has reached zero.
decr t decrements the count of the countdown latch t, releasing all waiting threads if the count reaches zero.
The count is not logically modified after it has reached zero.
val await :
Await_kernel.Await.t @ local ->
(t @ local ->
Base.unit) @ local @@ portableawait w t suspends the caller until the latch t is decremented to zero.
val await_or_cancel :
Await_kernel.Await.t @ local ->
(Await_kernel.Cancellation.t @ local ->
(t @ local ->
Base.unit Await_kernel.Or_canceled.t) @ local) @ local @@ portableawait_or_cancel w c t is Completed () if c is not cancelled or Canceled otherwise