put t a
waits until is_empty t
, and then does set t a
. If there are multiple
concurrent put
s, there is no fairness guarantee (i.e. put
s may happen out of order
or may be starved).
set t a
sets the value in t
to a
, even if not (is_empty t)
. This is useful if
you want takers to have last-value semantics.
value_available t
returns a deferred d
that becomes determined when a value is in
t
. d
does not include the value in t
because that value may change after d
becomes determined and before a deferred bind on d
gets to run.
Repeated calls to value_available
will always return the same deferred until take
returns Some
.
take t
returns the value in t
and clears t
, or returns None
if is_empty t
.
take_exn
is like take
, except it raises if is_empty t
.
peek t
returns the value in t
without clearing t
, or returns None
is is_empty
t
. peek_exn t
is like peek
, except it raises if is_empty t
.