fix warnings

reimplement CCtimer's server loop with `Unix.select` because of a
deprecation warning.
This commit is contained in:
Simon Cruanes 2023-06-06 21:54:02 -04:00
parent afeb2b762a
commit 3975eb9862
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 4 additions and 3 deletions

View file

@ -15,7 +15,7 @@ end
exception Stopped exception Stopped
(** {2 Create a new Pool} *) (** {2 Create a new Pool} *)
module Make (P : PARAM) : sig module Make (_ : PARAM) : sig
val run : (unit -> _) -> unit val run : (unit -> _) -> unit
(** [run f] schedules [f] for being executed in the thread pool. *) (** [run f] schedules [f] for being executed in the thread pool. *)

View file

@ -78,9 +78,9 @@ let serve timer =
| Wait delay -> wait delay | Wait delay -> wait delay
(* wait for [delay] seconds, or until something happens on [fifo_in] *) (* wait for [delay] seconds, or until something happens on [fifo_in] *)
and wait delay = and wait delay =
let read = Thread.wait_timed_read timer.fifo_in delay in ignore (Unix.select [ timer.fifo_in ] [] [] delay : _ * _ * _);
(* remove char from fifo, so that next write can happen *) (* remove char from fifo, so that next write can happen *)
if read then ignore (Unix.read timer.fifo_in buf 0 1); (try ignore (Unix.read timer.fifo_in buf 0 1 : int) with _ -> ());
next () next ()
in in
next () next ()
@ -89,6 +89,7 @@ let nop_handler_ _ = ()
let create () = let create () =
let fifo_in, fifo_out = Unix.pipe () in let fifo_in, fifo_out = Unix.pipe () in
Unix.set_nonblock fifo_in;
let timer = let timer =
{ {
stop = false; stop = false;