package picos
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=343a8b4759239ca0c107145b8e2cc94c14625fecc0b0887d3c40a9ab7537b8da
sha512=db22b0a5b3adc603c0e815c9011c779f892b9ace76be018b2198d3e24a7d96727c999701025fe5a5fd07d0b452cb7286fc50c939aba0e4dce809941e9ebc12a6
doc/picos.randos/Picos_randos/index.html
Module Picos_randos
Source
Randomized multi-threaded effects based Picos
compatible scheduler for OCaml 5.
ℹ️ This scheduler implementation is specifically intended for testing libraries implemented in Picos.
Picos
is an interface that allows schedulers to make scheduling decisions freely. After each effect this scheduler picks the next fiber to run randomly from the collection of ready fibers. This can help to discover bugs in programs implemented in Picos that make invalid scheduling assumptions.
Represents a shared context for randomized runners.
context ()
creates a new context for randomized runners. The context should be consumed by a call of run ~context ...
.
runner_on_this_thread context
starts a runner on the current thread to run fibers on the context. The runner returns when run ~context ...
returns.
run main
runs the main
thunk with the scheduler. Returns after main
and all of the fibers spawned by main
have returned.
The optional context
argument specifies a context in which to run the main
thunk. If unspecified, a new context is automatically created and the scheduler will be single-threaded. By creating a context, spawning concurrent or parallel runners on to the context, and then explicitly passing the context to run ~context ...
one can create a multi-threaded scheduler. Only a single call of run
per context is allowed.
The optional forbid
argument defaults to false
and determines whether propagation of cancelation is initially allowed.