Hello,
I’m happy to announce the first release of nanoev, yet another event loop abstraction. My goal with it is to have a narrow-waist interface between event loops (for now, select
and poll
) and various abstractions built directly on top (for now using picos
), without tying the event loop abstraction itself to a particular scheduler. The core interface for the event loop is basically:
type t
val wakeup_from_outside : t -> unit
val step : t -> unit
(** Run one step of the event loop until something happens *)
val close : t -> Unix.file_descr -> unit
(** 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 :
t -> Unix.file_descr -> 'a -> 'b -> (closed:bool -> 'a -> 'b -> unit) -> unit
val on_writable :
t -> Unix.file_descr -> 'a -> 'b -> (closed:bool -> 'a -> 'b -> unit) -> unit
val run_after_s : t -> float -> 'a -> 'b -> ('a -> 'b -> unit) -> unit
and nothing else. I’ve also started experimenting with using it to drive tiny_httpd.
docs: https://c-cube.github.io/nanoev/
release link: https://github.com/c-cube/nanoev/releases/tag/v0.1