]> mj.ucw.cz Git - libucw.git/commit
Mainloop: Avoid polling for an empty set of events
authorMartin Mares <mj@ucw.cz>
Fri, 6 Mar 2015 13:50:05 +0000 (14:50 +0100)
committerMartin Mares <mj@ucw.cz>
Fri, 6 Mar 2015 13:50:05 +0000 (14:50 +0100)
commit0c2909a2920a39a9fe2501b562571d913fd8503f
tree7be6a24371a8272521b9eb569c54d8afc2a4d0b6
parente792555a90a783f35f076074b9132fa85d344e2f
Mainloop: Avoid polling for an empty set of events

If a main_file was active, but it did not have any handlers set,
it could happen that poll/epoll was called with an empty set of
requested events.

Alas, even in those cases POLLHUP or POLLERR could be delivered,
leading to an endless loop of such events. (Remember that we do not
use the edge-triggered mode of epoll as we want to be compatible
with plain poll semantics in handlers.)

From now on, we avoid this situation by removing the fd from the
poll set temporarily.

Also, this led to a slight unification of code paths.
ucw/mainloop.c
ucw/mainloop.h