package picos
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=343a8b4759239ca0c107145b8e2cc94c14625fecc0b0887d3c40a9ab7537b8da
sha512=db22b0a5b3adc603c0e815c9011c779f892b9ace76be018b2198d3e24a7d96727c999701025fe5a5fd07d0b452cb7286fc50c939aba0e4dce809941e9ebc12a6
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.
ℹ️ Within this library, the Terminate
exception does not, by itself, indicate an error. Raising it inside a fiber forked within the structured concurrency constructs of this library simply causes the relevant part of the tree of fibers to be terminated.
⚠️ If Terminate
is raised in the main fiber of a Bundle
, and no other exceptions are raised within any fiber inside the bundle, the bundle will then, of course, raise the Terminate
exception after all the fibers have been terminated.
An exception that can be used to collect exceptions, typically indicating errors, from multiple fibers.
ℹ️ The Terminate
exception is not considered an error within this library and the structuring constructs do not include it in the list of Errors
.
raise_if_canceled ()
checks whether the current fiber has been canceled and if so raises the exception that the fiber was canceled with.
ℹ️ Within this library fibers are canceled using the Terminate
exception.
yield ()
asks the current fiber to be rescheduled.
sleep ~seconds
suspends the current fiber for the specified number of seconds
.
protect thunk
forbids propagation of cancelation for the duration of thunk ()
.
ℹ️ With the constructs provided by this library it is not possible to prevent a fiber from being canceled, but it is possible for a fiber to forbid the scheduler from propagating cancelation to the fiber.
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.