From c033ead992a4e7bd8d031f25f3fa1256532c0540 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Fri, 29 Nov 2013 14:36:10 +0100 Subject: 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. --- src/sim/async.hh | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/sim/async.hh') diff --git a/src/sim/async.hh b/src/sim/async.hh index 6dd5b8a0d..67f686a59 100644 --- a/src/sim/async.hh +++ b/src/sim/async.hh @@ -40,14 +40,12 @@ /// @name Asynchronous event flags. /// To avoid races, signal handlers simply set these flags, which are /// then checked in the main event loop. Defined in main.cc. -/// @note See the PollQueue object (in pollevent.hh) for the use of async_io and async_alarm. //@{ extern volatile bool async_event; ///< Some asynchronous event has happened. extern volatile bool async_statdump; ///< Async request to dump stats. extern volatile bool async_statreset; ///< Async request to reset stats. extern volatile bool async_exit; ///< Async request to exit simulator. extern volatile bool async_io; ///< Async I/O request (SIGIO). -extern volatile bool async_alarm; ///< Async alarm event (SIGALRM). extern volatile bool async_exception; ///< Python exception. //@} -- cgit v1.2.3