mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-14 14:56:17 -05:00
remove dead code
This commit is contained in:
parent
26779e6e12
commit
3530527522
1 changed files with 0 additions and 72 deletions
|
|
@ -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
|
||||
*)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue