= 1024" x-on:close-sidebar="sidebar=window.innerWidth >= 1024 && true">
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Mailbox variables
"Mailbox" variables implement a synchronising variable, used for communication between concurrent threads.
This code adapted from Comparing lightweight threads (eigenclass.org)
The type of a mailbox variable. Mailbox variables are used to communicate values between threads in a synchronous way. The type parameter specifies the type of the value propagated from put
to take
.
val create : 'a -> 'a t
create v
creates a new mailbox variable containing value v
.
val create_empty : unit -> 'a t
create ()
creates a new empty mailbox variable.
put mvar value
puts a value into a mailbox variable. This value will remain in the mailbox until take
is called to remove it. If the mailbox is not empty, the current thread will block until it is emptied.