package poll

  1. Overview
  2. Docs

Module PollSource

Sourcemodule Event : sig ... end
Sourcemodule Backend : sig ... end
Sourcemodule Timeout : sig ... end
Sourcemodule Poll_intf : sig ... end
include Poll_intf.S
Sourcetype t
Sourceval create : unit -> t

create creates a new instance of a poller.

Sourceval set : t -> Unix.file_descr -> Event.t -> unit

set t fd event updates the state of the set of file descriptors monitored by the poller. Event.none can be used to delete a fd from the set of descriptors that are monitored.

Sourceval wait : t -> Timeout.t -> [ `Ok | `Timeout ]

wait t timeout waits for at least one event to be ready, unless the user provides timeout is reached.

Sourceval clear : t -> unit

clear clears the number of i/o events that are ready to be consumed. This should be called after the user consumes all events that are available after wait.

Sourceval iter_ready : t -> f:(Unix.file_descr -> Event.t -> unit) -> unit

iter_ready iterates over the events that are ready after a call to wait.

Sourceval close : t -> unit

close closes the poller instance.

Sourceval create' : (module Poll_intf.S) -> t

create' accepts a user-supplied polling implementation and uses it to create a new poller instance.

Sourceval backend : t -> Backend.t

backend returns the io event notification backend (ex: kqueue, epoll, etc) used by the poller instance.

OCaml

Innovation. Community. Security.