package async_unix
Monadic concurrency library
Install
Dune Dependency
Authors
Maintainers
Sources
async_unix-v0.13.0.tar.gz
sha256=6ad4b4271b1a28150e2e6ddddcdc7e6df2c144c3221be3fa64d400e9500ebe9c
md5=1f150e28eeca17ebf3ff65641132c26d
doc/async_unix.thread_safe_pipe/Thread_safe_pipe/If_closed/index.html
Module Thread_safe_pipe.If_closed
Functions that write elements to the pipe take an If_closed.t
argument to specify how to deal with the possibility that the pipe is closed.
The alternatives are to Raise
on a closed pipe, or Return
a variant indicating whether the pipe is closed. This allows lightweight syntax for calls that want to raise if the pipe is closed:
write t a ~if_closed:Raise
It also allows lightweight syntax for calls that want to match on whether the pipe was closed:
match write t a ~if_closed:Return with
| Closed -> ...
| Written -> ...
Returning a variant is essential when one wants to distinguish a closed pipe from other errors. Also, since pipe-writing functions acquire the Async lock, it would be incorrect (due to races) to check is_closed
prior to the lock acquisition.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>