Module Cell.Drop

Drop cells.

A drop cell is a cell on which functions can exchange values:

Cells

type 'a t

The type for drop cells with value of type 'a.

val make : unit -> 'a t

make () is a new empty drop cell.

val take : 'a t -> 'a

take cell blocks until the cell is full with v, empties the cell and continues with v. If there are multiple blocked take and a single put occurs, only the earliest take unblocks.

val put : 'a t -> 'a -> unit

put cell v blocks until the cell is empty and fills it with v. If there are multiple blocked put on the same cell and a single take occurs, only the earliest put unblocks.

Predicate

val is_empty : 'a t -> bool

is_empty cell is true if and only if cell is empty.

Actions

val take' : 'a t -> 'a Action.t

take' cell is the action for take. An action invocation is enabled when cell is filled with a value v. The invocation synchronizes with v if it manages to empty the cell by taking v.

val put' : 'a t -> 'a -> 'tag -> 'tag Action.t

put' cell v tag is the action for put. An action invocation is enabled when cell is empty. The invocation synchronizes with tag if it manages to put v in cell.