package picos
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=544804c0bde4b29764f82f04e7defed7c06bc43e5a6ce3f7fdc326cb54a7f066
sha512=4c93427e477fb52374a554a8b9c4c92836a9b5899161275d1473269ab526a1f59177209140631ed763a55be375855dea12f076e18bf4124522414986c0e257be
doc/picos.structured/Picos_structured/Control/index.html
Module Picos_structured.Control
Source
Basic control operations and exceptions for structured concurrency.
An exception that is used to signal fibers, typically by canceling them, that they should terminate by letting the exception propagate. This does not, by itself, indicate an error.
An exception that can be used to collect exceptions, typically indicating errors, from multiple fibers.
raise_if_canceled ()
checks whether the current fiber has been canceled and if so raises the exception that the fiber was canceled with.
yield ()
asks the current fiber to be rescheduled.
sleep ~seconds
suspends the current fiber for specified number of seconds.
protect thunk
forbids cancelation for the duration of thunk ()
.
block ()
suspends the current fiber until it is canceled at which point the cancelation exception will be raised.
⚠️ Beware that protect block
never returns and you don't want that.