]> mj.ucw.cz Git - libucw.git/commit
Main: Unified support for poll and epoll
authorMartin Mares <mj@ucw.cz>
Fri, 30 Jul 2010 18:24:56 +0000 (20:24 +0200)
committerMartin Mares <mj@ucw.cz>
Wed, 18 Aug 2010 16:12:58 +0000 (18:12 +0200)
commit1d6a9a1fe4e2a62194c62aa756833b96c6807a7e
tree8a2bab840b6c8dff46a071abcfb4baff7f85d265
parenta27367df4d44e08ed719f6450bce960ca4b9cccc
Main: Unified support for poll and epoll

When the epoll mechanism is available in the system library, use it.

Rewritten processing of file events: when (e)poll completes, all pending
events are scanned and the corresponding files are relinked to another
list. Then this list is processed entry by entry and callbacks are
performed. When file_add() or file_del() is requested from the callback
function, the file is just relinked to the main file_list and the worst
thing which can happen is that an event will be postponed to the next
iteration of the main loop.

To achieve this, I had to decouple the order of entries in the poll_table
from the order of files in the file_list by introducing an auxiliary
array of pointers mapping poll_table entries to file structs.

All tricks with stopping the event scanning loop when poll_table_obsolete
becomes set are gone.
ucw/mainloop.c
ucw/mainloop.h
ucw/perl/UCW/Configure/LibUCW.pm