Windows build fixes
[ghc-hetmet.git] / rts / win32 / ConsoleHandler.c
index 76ebea0..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()
@@ -199,7 +203,7 @@ void startSignalHandlers(Capability *cap)
  * Evacuate the handler stack. _Assumes_ that console event delivery
  * has already been blocked.
  */
-void markSignalHandlers (evac_fn evac STG_UNUSED)
+void markSignalHandlers (evac_fn evac STG_UNUSED, void *user STG_UNUSED)
 {
     // nothing to mark; the console handler is a StablePtr which is
     // already treated as a root by the GC.
@@ -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;
     }