package picos

  1. Overview
  2. Docs
Pico scheduler interface

Install

Dune Dependency

Authors

Maintainers

Sources

picos-0.4.0.tbz
sha256=343a8b4759239ca0c107145b8e2cc94c14625fecc0b0887d3c40a9ab7537b8da
sha512=db22b0a5b3adc603c0e815c9011c779f892b9ace76be018b2198d3e24a7d96727c999701025fe5a5fd07d0b452cb7286fc50c939aba0e4dce809941e9ebc12a6

doc/src/picos.structured/run.ml.html

Source file run.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
open Picos

let wrap_all t main =
  Bundle.unsafe_incr t;
  fun () ->
    if Bundle.is_running t then begin
      try main () with exn -> Bundle.error t (Exn_bt.get exn)
    end;
    Bundle.decr t

let wrap_any t main =
  Bundle.unsafe_incr t;
  fun () ->
    if Bundle.is_running t then begin
      try
        main ();
        Bundle.terminate t
      with exn -> Bundle.error t (Exn_bt.get exn)
    end;
    Bundle.decr t

let run actions wrap =
  Bundle.join_after @@ fun t ->
  try
    let mains = List.map (wrap t) actions in
    Fiber.spawn ~forbid:false t.bundle mains
  with exn ->
    Bundle.unsafe_reset t;
    raise exn

let all actions = run actions wrap_all
let any actions = run actions wrap_any
OCaml

Innovation. Community. Security.