package picos
Pico scheduler framework
Install
Dune Dependency
Authors
Maintainers
Sources
picos-0.1.0.tbz
sha256=0f2dcc67ddd127c68f388f2c36a8725a15723e6aeba7d1ddfcf4e016b54a4674
sha512=bee2a99458a451be285e2f13cc3a9deda8eed4e118bcdfc51c256d2da5bae92eec3386c318fe42dcf451421543b519dc064967158b3f417c9b7b44ce97c5fb75
doc/picos.threaded/Picos_threaded/index.html
Module Picos_threaded
Source
Basic Thread
based Picos
compatible scheduler for OCaml 4.
ℹ️ This scheduler implementation is mostly meant as an example and for use in testing libraries implemented in Picos
.
Briefly:
current
returns the current fiber from the per thread state.spawn
creates a newThread
for each fiber.yield
just callsThread.yield
.cancel_after
uses a per-domain background thread that runs aUnix.select
loop to cancel computations.await
uses a per thread mutex and condition to suspend the thread.
⚠️ This scheduler is probably suitable for simple applications that do not spawn a lot of fibers. If an application uses a lot of short lived fibers, then a more sophisticated scheduler implementation using some sort of thread pool will likely perform significantly better.
⚠️ This scheduler implementation also works on OCaml 5, of course, but on OCaml 5 a scheduler that implements an effect handler directly is likely to perform better.
run ~forbid main
runs the main
thunk with the scheduler. Returns after main
and all of the fibers spawned by main
have returned.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>