base: Fix race in PollQueue and remove SIGALRM
Review Request #2036 - Created Oct. 7, 2013 and submitted
| Information | |
|---|---|
| Andreas Sandberg | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 9907:6b8977951300 --------------------------- 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.
Ran on x86 with KVM. Verified that asynchronous sockets work (terminal). Verified that IO happening before enabling asynchronous triggers a poll in the next iteration of the event loop (this was not the case before without the SIGALRM hack).
seems fine to me, but would be nice to get Nate's opinion since he wrote this originally
It's been a decade since I wrote that code, so I don't really remember the issues clearly, but it looks OK.
