package lwt
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=9687c14532a90af1098b646bde219a70
sha512=44ad793741a3ba52dfc07a190790d6e3207f146c42a4e1e11adc76f9d7fc9bee93d7fe18376882bb27e7e7e286be5807498884367b172a4ebc067028fa0c824c
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.