remove dead code

This commit is contained in:
Simon Cruanes 2024-03-06 23:45:05 -05:00
parent 26779e6e12
commit 3530527522
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -284,75 +284,3 @@ let run_every_s (self : t) delay f : Cancel_handle.t =
let h = Handle.fresh H_timer in
Main_loop.push self (Incoming_msg.Run_every (delay, h, f));
Cancel_handle.Cancel2 (Main_loop.push, self, Incoming_msg.Cancel_timer h)
(*
class unix_ev_loop =
let _timer = Timer.create () in
let _io_wait : IO_tbl.t = IO_tbl.create () in
let _in_blocking_section = ref false in
let _magic_pipe_read, _magic_pipe_write = Unix.pipe ~cloexec:true () in
let () =
Unix.set_nonblock _magic_pipe_read;
Unix.set_nonblock _magic_pipe_write
in
let[@inline] has_pending_tasks () =
_io_wait.n_read > 0 || _io_wait.n_write > 0 || Timer.has_tasks _timer
in
object
(* val read_ : (cancel_handle -> unit) Int_tbl.t = Int_tbl.create 32 *)
method one_step ~block () : unit =
let delay = process_expired_timers_ _timer in
let delay =
if block then
Option.value delay ~default:10.
else
(* do not wait *)
0.
in
let reads, writes = IO_tbl.prepare_select _io_wait in
if has_pending_tasks () then (
_in_blocking_section := true;
let reads, writes, _ =
Unix.select (_magic_pipe_read :: reads) writes [] delay
in
_in_blocking_section := false;
IO_tbl.handle_ready ~ignore_read:_magic_pipe_read _io_wait reads writes
);
()
method on_readable
: Unix.file_descr -> (cancel_handle -> unit) -> cancel_handle =
fun fd f : cancel_handle ->
let ev = IO_wait.make f in
IO_tbl.add_io_wait _io_wait fd Read ev;
ev.as_cancel_handle
method on_writable
: Unix.file_descr -> (cancel_handle -> unit) -> cancel_handle =
fun fd f : cancel_handle ->
let ev = IO_wait.make f in
IO_tbl.add_io_wait _io_wait fd Write ev;
ev.as_cancel_handle
method on_timer
: float -> repeat:bool -> (cancel_handle -> unit) -> cancel_handle =
fun delay ~repeat f ->
if repeat then
Timer.run_every _timer delay f
else
Timer.run_after _timer delay f
method interrupt_if_in_blocking_section =
if !_in_blocking_section then (
let b = Bytes.create 1 in
ignore (Unix.write _magic_pipe_write b 0 1 : int)
)
method has_pending_tasks : bool = has_pending_tasks ()
end
*)