B0_std.Bval
Blocking values.
Note. In direct style the Fut.t
values would go away. For now be bundled lazy blocking values in the same structure.
Note. This is an IVar.
val of_val : 'a -> 'a t
of_val v
is a (non-)blocking value holding v
.
val of_lazy_fun : (unit -> 'a) -> 'a t
val is_lazy : 'a t -> bool
is_lazy bv
is true
iff bv
is a lazily triggered value.
val set : 'a setter -> 'a -> unit
set s v
sets the blocking value of_setter s
to value v
. Raises Invalid_argument
if set
is already set.
val try_set : 'a setter -> 'a -> bool
try_set s v
is true
if iv
was set to v
and false
if iv
was already set.
val try_set' : 'a setter -> (unit -> 'a) -> bool
try_set' s f
is true
if iv
was set to f ()
and false
if iv
was already set, in the latter case f
may be or may not have been called.
get bv
is the value of bv
. In direct style, this should be a blocking call.
val poll : 'a t -> 'a option
poll bv
is None
if get bv
would block and Some _
if it does not block. If bv
was created with of_lazy_fun
, this ensure the computation gets triggered.
val stir : 'a t -> unit
stir bv
is ignore (poll v)
. Useful if you know bv
will be needed later and may be a of_lazy_fun
.