package lwt
Install
Dune Dependency
Authors
Maintainers
Sources
md5=18742da8b8fe3618e3fa700b7a884fe7
sha512=1c51fdb4d0856c89e2df08a1c0095ef28ebd0f613b07b03d0f66501ca5486515562071291e6d0932e57587ed0c9362c8b92c5c9eddb4d2bb2f5e129986b484a7
doc/lwt/Lwt_mvar/index.html
Module Lwt_mvar
Source
Mailbox variables
“Mailbox” variables implement a synchronising variable, used for communication between concurrent threads.
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
.
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.
take mvar
will take any currently available value from the mailbox variable. If no value is currently available, the current thread will block, awaiting a value to be put
by another thread.
take_available mvar
immediately takes the value from mvar
without blocking, returning None
if the mailbox is empty.