package fuseau
A simple IO and concurrency library for OCaml 5
Install
Dune Dependency
Authors
Maintainers
Sources
fuseau-0.1.tbz
sha256=8a9339d239aa371d0c4aceb23d7601a1b7da8f42d84542cee30669cc95addb6a
sha512=fa656c7311371344f0c6ebf08c666afc33296558ccc678ed87baf2f9ba54035cd4c5caca4257212416296fcdbdfc1687c46cc2ebea3548c792ea72602b85b832
doc/src/fuseau/event_loop.ml.html
Source file event_loop.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
(** Abstraction over an event loop, from the pov of the scheduler. All the scheduler cares about is running an iteration of the loop, with or without blocking; and interrupting the loop if it's in the middle of blocking. *) (** Abstract event loop, inspired by Lwt engine *) class type t = object method one_step : block:bool -> unit -> unit (** Run one step of the event loop. @param block if [true], the call might block until the next timeout or until the next IO event occurs. If [false], this does not block and returns after having processed the available events. *) method on_timer : float -> repeat:bool -> (Cancel_handle.t -> unit) -> Cancel_handle.t (** [on_timer delay ~repeat f] runs [f] after [delay]. @param repeat if true runs [f] every [delay] seconds *) method interrupt_if_in_blocking_section : unit (** If run from inside the event loop when it's waiting, wakes the event loop up *) end let[@inline] one_step (self : #t) ~block () = self#one_step ~block () let[@inline] on_timer (self : #t) delay ~repeat f = self#on_timer delay ~repeat f let[@inline] interrupt_if_in_blocking_section (self : #t) : unit = self#interrupt_if_in_blocking_section
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>