package picos_mux
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=3f5a08199cf65c2dae2f7d68f3877178f1da8eabf5376e15114e5a8958087dfa
sha512=ad24910c47ce614268c4268874bb918da7f8b5f03b3ad706bbf30323635262e94ddab6be24eaebbca706bfa82c0a517d4272b396459e020c185942125c9bdb7b
doc/picos_mux.fifo/Picos_mux_fifo/index.html
Module Picos_mux_fifo
Source
Basic single-threaded effects based Picos
compatible scheduler for OCaml 5.
This scheduler uses a queue specifically optimized for a single-threaded scheduler to implement a basic FIFO scheduler. This scheduler also gives priority to fibers woken up due to being canceled.
🐌 Due to FIFO scheduling this scheduler performs poorly on highly parallel workloads.
ℹ️ See Picos_mux_multififo
for a multi-threaded variation of this scheduler.
ℹ️ This scheduler implementation is mostly meant as an example and for use in testing libraries implemented in Picos
.
⚠️ This scheduler uses Picos_io_select
internally. If running multiple threads that each run this scheduler, Picos_io_select.configure
must be called by the main thread before creating other threads.
val run_fiber :
?quota:int ->
?fatal_exn_handler:(exn -> unit) ->
Picos.Fiber.t ->
(Picos.Fiber.t -> unit) ->
unit
run_fiber fiber main
runs the main
program as the specified fiber
and returns after main
and all of the fibers spawned by main
have returned.
The optional quota
argument defaults to Int.max_int
and determines the number of effects a fiber is allowed to perform before it is forced to yield.
val run :
?quota:int ->
?fatal_exn_handler:(exn -> unit) ->
?forbid:bool ->
(unit -> 'a) ->
'a
run main
is equivalent to calling run_fiber
with a freshly created fiber and main
wrapped to capture the result of main
.
The optional forbid
argument defaults to false
and determines whether propagation of cancelation is initially allowed.