summaryrefslogtreecommitdiff
path: root/src/sim/init.cc
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas@sandberg.pp.se>2013-11-29 14:36:10 +0100
committerAndreas Sandberg <andreas@sandberg.pp.se>2013-11-29 14:36:10 +0100
commitc033ead992a4e7bd8d031f25f3fa1256532c0540 (patch)
treeb66732c44d91033ef6e01ddf61705b738fc5a151 /src/sim/init.cc
parent9c57d5b5a66df60f77d1209f6660e4986da4bf8e (diff)
downloadgem5-c033ead992a4e7bd8d031f25f3fa1256532c0540.tar.xz
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.
Diffstat (limited to 'src/sim/init.cc')
-rw-r--r--src/sim/init.cc18
1 files changed, 0 insertions, 18 deletions
diff --git a/src/sim/init.cc b/src/sim/init.cc
index 660fab62b..63af2dd88 100644
--- a/src/sim/init.cc
+++ b/src/sim/init.cc
@@ -104,15 +104,6 @@ ioHandler(int sigtype)
async_io = true;
}
-// Handle SIGALRM
-static void
-alrmHandler(int sigtype)
-{
- async_event = true;
- async_alarm = true;
- alarm(1);
-}
-
static void
installSignalHandler(int signal, void (*handler)(int sigtype))
{
@@ -156,15 +147,6 @@ initSignals()
// Install a SIGIO handler to handle asynchronous file IO. See the
// PollQueue class.
installSignalHandler(SIGIO, ioHandler);
-
- // Setup an alarm handler that triggers every second. This
- // triggers a PollQueue service just like a SIGIO. It is
- // /probably/ used to work around a bug in the poll queue (likely
- // a race between setting up a asynchronous IO and data becoming
- // available), but its use isn't documented anywhere.
- // TODO: Find out why this is needed and fix the original bug.
- installSignalHandler(SIGALRM, alrmHandler);
- alarm(1);
}
// The python library is totally messed up with respect to constness,