package eio
Effect-based direct-style IO API for OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
eio-0.14.tbz
sha256=52f85b947d3e0de70940b5bbaac0d3e78841fea5648e73af7d8a754ab51c871b
sha512=944095b1131d2dcc1f0d415fe46fd78b883733e0f95985e3a0feafe73b1703606ec60560abf36c16c364cc60164b7330f236e39569e264c702bb5647e28bfd3c
doc/src/eio/domain_manager.ml.html
Source file domain_manager.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
open Std type ty = [`Domain_mgr] type 'a t = ([> ty] as 'a) r module Pi = struct module type MGR = sig type t val run : t -> (cancelled:exn Promise.t -> 'a) -> 'a val run_raw : t -> (unit -> 'a) -> 'a end type (_, _, _) Resource.pi += | Mgr : ('t, (module MGR with type t = 't), [> ty]) Resource.pi let mgr (type t) (module X : MGR with type t = t) = Resource.handler [H (Mgr, (module X))] end let run_raw (Resource.T (t, ops)) fn = let module X = (val (Resource.get ops Pi.Mgr)) in X.run_raw t fn let run (Resource.T (t, ops)) fn = let module X = (val (Resource.get ops Pi.Mgr)) in X.run t @@ fun ~cancelled -> (* If the spawning fiber is cancelled, [cancelled] gets set to the exception. *) try Fiber.first (fun () -> match Promise.await cancelled with | Cancel.Cancelled ex -> raise ex (* To avoid [Cancelled (Cancelled ex))] *) | ex -> raise ex (* Shouldn't happen *) ) fn with ex -> match Promise.peek cancelled with | Some (Cancel.Cancelled ex2 as cex) when ex == ex2 -> (* We unwrapped the exception above to avoid [fn] seeing a double cancelled exception. But this means that the top-level reported the original exception, which isn't what we want. *) raise cex | _ -> raise ex
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>