mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
fix warnings
reimplement CCtimer's server loop with `Unix.select` because of a deprecation warning.
This commit is contained in:
parent
afeb2b762a
commit
3975eb9862
2 changed files with 4 additions and 3 deletions
|
|
@ -15,7 +15,7 @@ end
|
|||
exception Stopped
|
||||
|
||||
(** {2 Create a new Pool} *)
|
||||
module Make (P : PARAM) : sig
|
||||
module Make (_ : PARAM) : sig
|
||||
val run : (unit -> _) -> unit
|
||||
(** [run f] schedules [f] for being executed in the thread pool. *)
|
||||
|
||||
|
|
|
|||
|
|
@ -78,9 +78,9 @@ let serve timer =
|
|||
| Wait delay -> wait delay
|
||||
(* wait for [delay] seconds, or until something happens on [fifo_in] *)
|
||||
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 *)
|
||||
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 ()
|
||||
in
|
||||
next ()
|
||||
|
|
@ -89,6 +89,7 @@ let nop_handler_ _ = ()
|
|||
|
||||
let create () =
|
||||
let fifo_in, fifo_out = Unix.pipe () in
|
||||
Unix.set_nonblock fifo_in;
|
||||
let timer =
|
||||
{
|
||||
stop = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue