package eio
Effect-based direct-style IO API for OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
eio-0.13.tbz
sha256=82537ee1c5b1829fde8207614a4e39f560bd582332841290ed5ef76691f3af70
sha512=69fc509e5ed34da64c3c26fa22558ce7f0cb42afa65c864c57dbb05948e12c0f4f6ab7b77a07f8b292ea3a18748ed46deb9da6af74852115da5e938177b3bf18
doc/src/eio.utils/zzz.ml.html
Source file zzz.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
module Key = struct type t = Optint.Int63.t let compare = Optint.Int63.compare end module Job = struct type t = { time : Mtime.t; thread : unit Suspended.t; } let compare a b = Mtime.compare a.time b.time end module Q = Psq.Make(Key)(Job) type t = { mutable sleep_queue: Q.t; mutable next_id : Optint.Int63.t; } let create () = { sleep_queue = Q.empty; next_id = Optint.Int63.zero } let add t time thread = let id = t.next_id in t.next_id <- Optint.Int63.succ t.next_id; let sleeper = { Job.time; thread } in t.sleep_queue <- Q.add id sleeper t.sleep_queue; id let remove t id = t.sleep_queue <- Q.remove id t.sleep_queue let pop t ~now = match Q.min t.sleep_queue with | Some (_, { Job.time; thread }) when time <= now -> Eio.Private.Fiber_context.clear_cancel_fn thread.fiber; t.sleep_queue <- Option.get (Q.rest t.sleep_queue); `Due thread | Some (_, { Job.time; _ }) -> `Wait_until time | None -> `Nothing
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>