base: Fix race in PollQueue and remove SIGALRM workaround

There is a race between enabling asynchronous IO for a file descriptor
and IO events happening on that descriptor. A SIGIO won't normally be
delivered if an event is pending when asynchronous IO is
enabled. Instead, the signal will be raised the next time there is an
event on the FD. This changeset simulates a SIGIO by setting the
async_io flag when setting up asynchronous IO for an FD. This causes
the main event loop to poll all file descriptors to check for pending
IO. As a consequence of this, the old SIGALRM hack should no longer be
needed and is therefore removed.
This commit is contained in:
Andreas Sandberg
2013-11-29 14:36:10 +01:00
parent 9c57d5b5a6
commit c033ead992
5 changed files with 11 additions and 23 deletions

View File

@@ -210,9 +210,8 @@ doSimLoop(EventQueue *eventq)
exitSimLoop("user interrupt received");
}
if (async_io || async_alarm) {
if (async_io) {
async_io = false;
async_alarm = false;
pollQueue.service();
}