summaryrefslogtreecommitdiff
path: root/src/base/pollevent.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/pollevent.cc')
-rw-r--r--src/base/pollevent.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/base/pollevent.cc b/src/base/pollevent.cc
index 67e97f98f..9ed6df4fe 100644
--- a/src/base/pollevent.cc
+++ b/src/base/pollevent.cc
@@ -214,4 +214,14 @@ PollQueue::setupAsyncIO(int fd, bool set)
if (fcntl(fd, F_SETFL, flags) == -1)
panic("Could not set up async IO");
+
+ // The file descriptor might already have events pending. We won't
+ // see them if they occurred before we set the FASYNC
+ // flag. Simulate a SIGIO to ensure that the FD will be polled in
+ // next iteration of the simulation loop. We could just poll it,
+ // but this is much simpler.
+ if (set) {
+ async_event = true;
+ async_io = true;
+ }
}