mirror of
https://github.com/c-cube/nanoev.git
synced 2025-12-06 11:15:48 -05:00
add max_fds to nanoev core interface
This commit is contained in:
parent
8de6936787
commit
7a0c3e1279
3 changed files with 10 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ module Impl = struct
|
||||||
clear: 'st -> unit;
|
clear: 'st -> unit;
|
||||||
wakeup_from_outside: 'st -> unit;
|
wakeup_from_outside: 'st -> unit;
|
||||||
close: 'st -> Unix.file_descr -> unit;
|
close: 'st -> Unix.file_descr -> unit;
|
||||||
|
max_fds: 'st -> int;
|
||||||
on_readable:
|
on_readable:
|
||||||
'a 'b.
|
'a 'b.
|
||||||
'st ->
|
'st ->
|
||||||
|
|
@ -39,6 +40,7 @@ type t = Impl.t
|
||||||
let[@inline] clear (Ev (ops, st)) = ops.clear st
|
let[@inline] clear (Ev (ops, st)) = ops.clear st
|
||||||
let[@inline] wakeup_from_outside (Ev (ops, st)) = ops.wakeup_from_outside st
|
let[@inline] wakeup_from_outside (Ev (ops, st)) = ops.wakeup_from_outside st
|
||||||
let[@inline] close (Ev (ops, st)) fd = ops.close st fd
|
let[@inline] close (Ev (ops, st)) fd = ops.close st fd
|
||||||
|
let[@inline] max_fds (Ev (ops, st)) = ops.max_fds st
|
||||||
|
|
||||||
let[@inline] on_readable (Ev (ops, st)) fd x y f : unit =
|
let[@inline] on_readable (Ev (ops, st)) fd x y f : unit =
|
||||||
ops.on_readable st fd x y f
|
ops.on_readable st fd x y f
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ module Impl : sig
|
||||||
clear: 'st -> unit;
|
clear: 'st -> unit;
|
||||||
wakeup_from_outside: 'st -> unit;
|
wakeup_from_outside: 'st -> unit;
|
||||||
close: 'st -> Unix.file_descr -> unit;
|
close: 'st -> Unix.file_descr -> unit;
|
||||||
|
max_fds: 'st -> int;
|
||||||
on_readable:
|
on_readable:
|
||||||
'a 'b.
|
'a 'b.
|
||||||
'st ->
|
'st ->
|
||||||
|
|
@ -43,6 +44,9 @@ val step : t -> unit
|
||||||
val close : t -> Unix.file_descr -> unit
|
val close : t -> Unix.file_descr -> unit
|
||||||
(** Close the file descriptor and clean it up *)
|
(** Close the file descriptor and clean it up *)
|
||||||
|
|
||||||
|
val max_fds : t -> int
|
||||||
|
(** Maximum number of file descriptors that can be observed at once. *)
|
||||||
|
|
||||||
val on_readable :
|
val on_readable :
|
||||||
t -> Unix.file_descr -> 'a -> 'b -> (closed:bool -> 'a -> 'b -> unit) -> unit
|
t -> Unix.file_descr -> 'a -> 'b -> (closed:bool -> 'a -> 'b -> unit) -> unit
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -243,12 +243,16 @@ let step (self : st) : unit =
|
||||||
|
|
||||||
()
|
()
|
||||||
|
|
||||||
|
(* limit for select is fixed and known *)
|
||||||
|
let max_fds _ = 1024
|
||||||
|
|
||||||
let ops : st Nanoev.Impl.ops =
|
let ops : st Nanoev.Impl.ops =
|
||||||
{
|
{
|
||||||
step;
|
step;
|
||||||
close;
|
close;
|
||||||
on_readable;
|
on_readable;
|
||||||
on_writable;
|
on_writable;
|
||||||
|
max_fds;
|
||||||
run_after_s;
|
run_after_s;
|
||||||
wakeup_from_outside;
|
wakeup_from_outside;
|
||||||
clear;
|
clear;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue