package picos_mux

  1. Overview
  2. Docs
Sample schedulers for Picos

Install

dune-project
 Dependency

Authors

Maintainers

Sources

picos-0.5.0.tbz
sha256=862d61383e2df93a876bedcffb1fd1ddc0f96c50b0e9c07943a2aee1f0e182be
sha512=87805379017ef4a7f2c11b954625a3757a0f1431bb9ba59132202de278b3e41adbe0cdc20e3ab23b7c9a8c5a15faeb7ec79348e7d80f2b14274b00df0893b8c0

doc/picos_mux.thread/Picos_mux_thread/index.html

Module Picos_mux_threadSource

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.

⚠️ 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.

⚠️ 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.

Sourceval run_fiber : ?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 main and all of the fibers spawned by main have returned.

Sourceval run : ?forbid:bool -> ?fatal_exn_handler:(exn -> unit) -> (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.