package picos_std

  1. Overview
  2. Docs
Sample libraries for Picos

Install

Dune Dependency

Authors

Maintainers

Sources

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

doc/picos_std.structured/Picos_std_structured/Run/index.html

Module Picos_std_structured.RunSource

Operations for running fibers in specific patterns.

Sourceval all : (unit -> unit) list -> unit

all actions starts the actions as separate fibers and waits until they all complete or one of them raises an unhandled exception other than Terminate, which is not counted as an error, after which the remaining fibers will be canceled.

⚠️ One of actions may be run on the current fiber.

⚠️ It is not guaranteed that any of the actions in the list are called. In particular, after any action raises an unhandled exception or after the main fiber is canceled, the actions that have not yet started may be skipped entirely.

all is roughly equivalent to

  let all actions =
    Bundle.join_after @@ fun bundle ->
    List.iter (Bundle.fork bundle) actions

but treats the list of actions as a single computation.

Sourceval any : (unit -> unit) list -> unit

any actions starts the actions as separate fibers and waits until one of them completes or raises an unhandled exception other than Terminate, which is not counted as an error, after which the rest of the started fibers will be canceled.

⚠️ One of actions may be run on the current fiber.

⚠️ It is not guaranteed that any of the actions in the list are called. In particular, after the first action returns successfully or after any action raises an unhandled exception or after the main fiber is canceled, the actions that have not yet started may be skipped entirely.

any is roughly equivalent to

  let any actions =
    Bundle.join_after @@ fun bundle ->
    try
      actions
      |> List.iter @@ fun action ->
         Bundle.fork bundle @@ fun () ->
         action ();
         Bundle.terminate bundle
    with Control.Terminate -> ()

but treats the list of actions as a single computation.

OCaml

Innovation. Community. Security.