Libev supports C<select>, C<poll>, the Linux-specific C<epoll>, the
BSD-specific C<kqueue> and the Solaris-specific event port mechanisms
Libev supports C<select>, C<poll>, the Linux-specific C<epoll>, the
BSD-specific C<kqueue> and the Solaris-specific event port mechanisms
Libev is very configurable. In this manual the default configuration will
be described, which supports multiple event loops. For more info about
Libev is very configurable. In this manual the default configuration will
be described, which supports multiple event loops. For more info about
loops, then all functions taking an initial argument of name C<loop>
(which is always of type C<struct ev_loop *>) will not have this argument.
loops, then all functions taking an initial argument of name C<loop>
(which is always of type C<struct ev_loop *>) will not have this argument.
Libev represents time as a single floating point number, representing the
(fractional) number of seconds since the (POSIX) epoch (somewhere near
Libev represents time as a single floating point number, representing the
(fractional) number of seconds since the (POSIX) epoch (somewhere near
inotify watch id. The default size is C<16> (or C<1> with C<EV_MINIMAL>),
usually more than enough. If you need to manage thousands of C<ev_stat>
watchers you might want to increase this value (I<must> be a power of
inotify watch id. The default size is C<16> (or C<1> with C<EV_MINIMAL>),
usually more than enough. If you need to manage thousands of C<ev_stat>
watchers you might want to increase this value (I<must> be a power of
This means that, when you have a watcher that triggers in one hour and
there are 100 watchers that would trigger before that then inserting will
This means that, when you have a watcher that triggers in one hour and
there are 100 watchers that would trigger before that then inserting will
as only the relative motion in the event queue has to be paid for.
=item Starting io/check/prepare/idle/signal/child watchers: O(1)
These just add the watcher into an array or at the head of a list.
as only the relative motion in the event queue has to be paid for.
=item Starting io/check/prepare/idle/signal/child watchers: O(1)
These just add the watcher into an array or at the head of a list.
=item Stopping check/prepare/idle watchers: O(1)
=item Stopping an io/signal/child watcher: O(number_of_watchers_for_this_(fd/signal/pid % EV_PID_HASHSIZE))
=item Stopping check/prepare/idle watchers: O(1)
=item Stopping an io/signal/child watcher: O(number_of_watchers_for_this_(fd/signal/pid % EV_PID_HASHSIZE))
correct watcher to remove. The lists are usually short (you don't usually
have many watchers waiting for the same fd or signal).
correct watcher to remove. The lists are usually short (you don't usually
have many watchers waiting for the same fd or signal).
-=item Finding the next timer per loop iteration: O(1)
+=item Finding the next timer in each loop iteration: O(1)
+
+By virtue of using a binary heap, the next timer is always found at the
+beginning of the storage array.
=item Each change on a file descriptor per loop iteration: O(number_of_watchers_for_this_fd)
A change means an I/O watcher gets started or stopped, which requires
=item Each change on a file descriptor per loop iteration: O(number_of_watchers_for_this_fd)
A change means an I/O watcher gets started or stopped, which requires
=item Priority handling: O(number_of_priorities)
Priorities are implemented by allocating some space for each
priority. When doing priority-based operations, libev usually has to
=item Priority handling: O(number_of_priorities)
Priorities are implemented by allocating some space for each
priority. When doing priority-based operations, libev usually has to