Module Event.Cell

module Cell: sig .. end
Inter-thread Shared variable.

This module implements inter-thread shared variable that can be read and write by differnt threads at a same time safely without making a new thread.

type 'a t 
The type of shared variable containing a element type of 'a
val make : unit -> 'a t
Make an empty variable.
val init_make : 'a -> 'a t
init_make v makes a variable containing a value v
val read : 'a t -> 'a Event.event
read c returns an event that read a element from the variable c. If the variable is empty, this event waits until the variable be filled by other thread.
val take : 'a t -> 'a Event.event
take c returns an event that takes a element and make the variable c empty.
val put : 'a t -> 'a -> unit Event.event
put c v puts the value v to varible c when it's empty. If the variable c is not empty, this event waits until the variable be empty by other thread.
val replace : 'a t -> ('a -> 'a) -> unit Event.event
replace c fn change the variable element x to fn x. During replace, read, take, put operations are blocked.