package picos_std

  1. Overview
  2. Docs
Sample libraries for Picos

Install

Dune Dependency

Authors

Maintainers

Sources

picos-0.6.0.tbz
sha256=3f5a08199cf65c2dae2f7d68f3877178f1da8eabf5376e15114e5a8958087dfa
sha512=ad24910c47ce614268c4268874bb918da7f8b5f03b3ad706bbf30323635262e94ddab6be24eaebbca706bfa82c0a517d4272b396459e020c185942125c9bdb7b

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.