Async_kernel.BvarSourceA Bvar is a synchronization point that allows one to broadcast a value to clients waiting 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. If nobody is waiting on a Bvar, then broadcasting to it is effectively a no-op, and the value that is broadcast is lost.
Another way to view Bvar is as a restriction of Condition that supports only broadcast, not signaling a single waiter. Dropping signal simplifies the implementation significantly.
An Mvar can mimick a unit Bvar.t through appropriate use of its API, but is also capable of wider range of synchronization functionality than a Bvar.
The 'permissions parameter is used for read/write permissions. See Perms for more information.
val sexp_of_t :
('a -> Sexplib0.Sexp.t) ->
('permissions -> Sexplib0.Sexp.t) ->
('a, 'permissions) t ->
Sexplib0.Sexp.tinclude Core.Invariant.S2
with type ('a, 'permissions) t := ('a, 'permissions) twait t becomes determined by the next call to broadcast t a.
broadcast t a causes all of the non-determined deferreds returned from wait t to become determined with a. If no such deferreds exist, this operation is a no-op.