module Libevent:The Ocaml Event library provides an interface to the event API.sig..end
The event API provides a mechanism to execute a function when a specific event on a file descriptor occurs or after a given time has passed.
This library is a wrapper of the libevent API made by Nils Provos. For more information about this library see: http://www.monkey.org/~provos/libevent.
Currently, libevent supports kqueue(2), select(2), poll(2) and
epoll(4). Support for /dev/poll is planned.
Author(s): Maas-Maarten Zeeman
type event
type event_flags =
| |
TIMEOUT |
(* | A timeout occurred. | *) |
| |
READ |
(* | A read is possible. | *) |
| |
WRITE |
(* | A write operation is possible. | *) |
| |
SIGNAL |
(* | A signal occurred. | *) |
typeevent_callback =Unix.file_descr -> event_flags -> unit
val create : unit -> eventval fd : event -> Unix.file_descrfd event returns the file descriptor associated with the eventval signal : event -> intsignal event returns the signal associated with the eventval set : event ->
Unix.file_descr ->
event_flags list -> persist:bool -> event_callback -> unitset event fd type persist callback initializes the event. The
flag persist makes an event persitent until Libevent.del is
called.val set_signal : event ->
signal:int -> persist:bool -> event_callback -> unitset_signal event signal persist callback initializes the event. The
flag persist makes an event persistent unit Libevent.del is
called.val add : event -> float option -> unitadd event timeout adds the event and schedules the execution
of the function specified with Libevent.set, or in at least the
time specified in the timeout. If timeout is None, no
timeout occures, and the function will only be called if a
matching event occurs on the file descriptor.val del : event -> unitval pending : event -> event_flags list -> boolval dispatch : unit -> unittype loop_flags =
| |
ONCE |
| |
NONBLOCK |
val loop : loop_flags -> unit