notice ^C exceptions when waiting for I/O
authorSimon Marlow <marlowsd@gmail.com>
Thu, 13 Nov 2008 11:43:42 +0000 (11:43 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Thu, 13 Nov 2008 11:43:42 +0000 (11:43 +0000)
rts/win32/AwaitEvent.c
rts/win32/ConsoleHandler.c

index 43e188f..2175626 100644 (file)
@@ -18,6 +18,7 @@
 #include "AwaitEvent.h"
 #include <windows.h>
 #include "win32/AsyncIO.h"
+#include "win32/ConsoleHandler.h"
 
 // Used to avoid calling abandonRequestWait() if we don't need to.
 // Protected by sched_mutex.
@@ -34,6 +35,16 @@ awaitEvent(rtsBool wait)
     workerWaitingForRequests = 1;
     ret = awaitRequests(wait);
     workerWaitingForRequests = 0;
+
+    // If a signal was raised, we need to service it
+    // XXX the scheduler loop really should be calling
+    // startSignalHandlers(), but this is the way that posix/Select.c
+    // does it and I'm feeling too paranoid to refactor it today --SDM
+    if (stg_pending_events != 0) {
+        startSignalHandlers(&MainCapability);
+        return;
+    }
+
     if (!ret) { 
       return; /* still hold the lock */
     }
index 25472cf..13011cb 100644 (file)
@@ -240,6 +240,9 @@ static BOOL WINAPI generic_handler(DWORD dwCtrlType)
            stg_pending_buf[stg_pending_events] = dwCtrlType;
            stg_pending_events++;
        }
+
+        // we need to wake up awaitEvent()
+        abandonRequestWait();
 #endif
        return TRUE;
     }