Module Lwt_engine

module Lwt_engine : sig..end

Lwt unix main loop engine


Events
type event

Type of events. An event represent a callback registered to be called when some event occurs.

val stop_event : event -> unit

stop_event event stops the given event.

val fake_event : event

Event which does nothing when stopped.

Event loop functions
val iter : bool -> unit

iter block performs one iteration of the main loop. If block is true the function must blocks until one event become available, otherwise it should just check for available events and return immediatly.

val on_readable : Unix.file_descr -> (event -> unit) -> event

on_readable fd f calls f each time fd becomes readable.

val on_writable : Unix.file_descr -> (event -> unit) -> event

on_readable fd f calls f each time fd becomes writable.

val on_timer : float -> bool -> (event -> unit) -> event

on_timer delay repeat f calls f one time after delay seconds. If repeat is true then f is called each delay seconds, otherwise it is called only one time.

val readable_count : unit -> int

Returns the number of events waiting for a file descriptor to become readable.

val writable_