This adds a call "start_timer_asap" which behaves as if a timer had
been added with a trigger time == now.
Printf.ksprintf logger fmt
module ConnMap = Map.Make (struct type t = Unix.file_descr let compare = compare end)
-
+
(* A module that supports finding a timer by handle as well as by expiry time. *)
module Timers = struct
let at = Unix.gettimeofday () +. time_offset_sec in
Timers.add_timer t.timers at cb
+let start_timer_asap t cb =
+ Timers.add_timer t.timers t.current_time cb
+
let start_periodic_timer t time_offset_sec period cb =
let orig_timer = ref (None: timer option) in
let resubmit_timer_closure () =
*)
val start_timer : t -> float (* offset, secs *) -> (unit -> unit) -> timer
+(** Enqueues an event that will be invoked in the next event loop
+ iteration. This behaves as if a timer had been set to fire with
+ "now" as the trigger time.
+*)
+val start_timer_asap : t -> (unit -> unit) -> timer
+
(** Starts a timer that will fire periodically. The timer needs
explicit cancellation.
*)