package picos
Pico scheduler framework
Install
Dune Dependency
Authors
Maintainers
Sources
picos-0.3.0.tbz
sha256=544804c0bde4b29764f82f04e7defed7c06bc43e5a6ce3f7fdc326cb54a7f066
sha512=4c93427e477fb52374a554a8b9c4c92836a9b5899161275d1473269ab526a1f59177209140631ed763a55be375855dea12f076e18bf4124522414986c0e257be
doc/src/picos.structured/control.ml.html
Source file control.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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
open Picos exception Terminate let terminate_bt = Exn_bt.get_callstack 0 Terminate let terminate_bt ?callstack () = match callstack with | None -> terminate_bt | Some n -> Exn_bt.get_callstack n Terminate exception Errors of Exn_bt.t list let () = Printexc.register_printer @@ function | Errors exn_bts -> let causes = List.map (fun exn_bt -> Printexc.to_string exn_bt.Exn_bt.exn) exn_bts |> String.concat "; " in Some (Printf.sprintf "Errors[%s]" causes) | _ -> None module Errors = struct type t = Exn_bt.t list Atomic.t let create () = Atomic.make [] let rec check (exn_bts : Exn_bt.t list) exns = match exn_bts with | [] -> () | [ exn_bt ] -> Printexc.raise_with_backtrace (Errors (exn_bt :: exns)) exn_bt.bt | exn_bt :: exn_bts -> check exn_bts (exn_bt :: exns) let check t = match Atomic.get t with | [] -> () | [ exn_bt ] -> Exn_bt.raise exn_bt | exn_bts -> check exn_bts [] let rec push t exn_bt backoff = let before = Atomic.get t in let after = exn_bt :: before in if not (Atomic.compare_and_set t before after) then push t exn_bt (Backoff.once backoff) let push t (exn_bt : Exn_bt.t) = if exn_bt.exn != Terminate then push t exn_bt Backoff.default end let raise_if_canceled () = Fiber.check (Fiber.current ()) let yield = Fiber.yield let sleep = Fiber.sleep let block () = match Trigger.await (Trigger.create ()) with | None -> failwith "impossible" | Some exn_bt -> Exn_bt.raise exn_bt let protect thunk = Fiber.forbid (Fiber.current ()) thunk
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>