Windows build fixes
[ghc-hetmet.git] / rts / win32 / ConsoleHandler.c
index 2cd10ec..19057a3 100644 (file)
@@ -5,10 +5,8 @@
 #include "Rts.h"
 #include <windows.h>
 #include "ConsoleHandler.h"
-#include "SchedAPI.h"
 #include "Schedule.h"
 #include "RtsUtils.h"
-#include "RtsFlags.h"
 #include "AsyncIO.h"
 #include "RtsSignals.h"
 
@@ -119,6 +117,12 @@ void initDefaultHandlers(void)
     }
 }
 
+void resetDefaultHandlers(void)
+{
+    if ( !SetConsoleCtrlHandler(shutdown_handler, FALSE) ) {
+       errorBelch("warning: failed to uninstall default console handler");
+    }
+}
 
 /*
  * Function: blockUserSignals()
@@ -234,6 +238,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;
     }