A Bvar
is a synchronization point that allows one to broadcast
a value to clients
wait
ing on the broadcast. With a Bvar
, one can efficiently notify multiple
clients of edge-triggered conditions, repeating as each edge trigger occurs.
Bvar
is like an ivar/deferred, except that it is always "empty" and can be
repeatedly "filled" (via broadcast
).
Another way to view Bvar
is as a restriction of Condition
that supports only
broadcast, not signal
ing a single waiter. Dropping signal
simplifies the
implementation significantly.
include sig ... end
val sexp_of_t : ('a ‑> Sexplib.Sexp.t) ‑> 'a t ‑> Sexplib.Sexp.t
include Core_kernel.Invariant.S1 with type a t := a t
val invariant : 'a Base__.Invariant_intf.inv ‑> 'a t Base__.Invariant_intf.inv
val create : unit ‑> 'a t
val wait : 'a t ‑> 'a Async_kernel__.Deferred0.t
wait t
becomes determined by the next call to broadcast t a
.
val broadcast : 'a t ‑> 'a ‑> unit
val has_any_waiters : 'a t ‑> bool
has_any_waiters t
returns true
iff there has been a call to wait t
since the
most recent call to broadcast t
.