Lwt unix main loop engine
Type of events. An event represent a callback registered to be called when some event occurs.
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 immediately.
on_readable fd f
calls f
each time fd
becomes readable.
on_readable fd f
calls f
each time fd
becomes writable.
Returns the number of events waiting for a file descriptor to become readable.
Returns the number of events waiting for a file descriptor to become writable.
Returns the number of registered timers.
An engine represent a set of functions used to register different kind of callbacks for different kind of events.
Destroy the engine, remove all its events and free its associated resources.
transfer engine
moves all events from the current engine to
engine
. Note that timers are reset in the destination
engine, i.e. if a timer with a delay of 2 seconds was
registered 1 second ago it will occurs in 2 seconds in the
destination engine.
Notes:
unit ->
unit
and not event -> unit
Cleanup resources associated to the engine.
Abstract class for engines.
Type of libev loops.
select fds_r fds_w timeout
waits for either:
fds_r
to become readablefds_w
to become writableand returns the list of readable file descriptor and the list of writable file descriptors.
Abstract class for engines based on a select-like function.
poll fds tiomeout
, where fds
is a list of tuples of the
form (fd, check_readable, check_writable)
, waits for either:
check_readable
set to
true
to become readablecheck_writable
set to
true
to become writableand returns the list of file descriptors with their readable and writable status.
Abstract class for engines based on a poll-like function.
set ?transfer ?destroy engine
replaces the current engine by
the given one.
If transfer
is true
(the default) all events from the
current engine are transferred to the new one.
If destroy
is true
(the default) then the current engine is
destroyed before being replaced.