Skip to content
Snippets Groups Projects
Commit 6aee4745 authored by Simon Marlow's avatar Simon Marlow Committed by pcapriotti
Browse files

Disable the timer signal while blocked in select() (#5991)

The threaded RTS had a fix for this a long time ago (#1623) but this
patch applies a similar fix to the non-threaded RTS.

MERGED from commit dd24d6bc
parent 27c2f292
No related merge requests found
...@@ -217,10 +217,19 @@ awaitEvent(rtsBool wait) ...@@ -217,10 +217,19 @@ awaitEvent(rtsBool wait)
ptv = NULL; ptv = NULL;
} }
/* Check for any interesting events */ while (1) { // repeat the select on EINTR
while ((numFound = select(maxfd+1, &rfd, &wfd, NULL, ptv)) < 0) { // Disable the timer signal while blocked in
if (errno != EINTR) { // select(), to conserve power. (#1623, #5991)
if (wait) stopTimer();
numFound = select(maxfd+1, &rfd, &wfd, NULL, ptv);
if (wait) startTimer();
if (numFound >= 0) break;
if (errno != EINTR) {
/* Handle bad file descriptors by unblocking all the /* Handle bad file descriptors by unblocking all the
waiting threads. Why? Because a thread might have been waiting threads. Why? Because a thread might have been
a bit naughty and closed a file descriptor while another a bit naughty and closed a file descriptor while another
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment