[project @ 2005-04-22 17:50:13 by sof]
authorsof <unknown>
Fri, 22 Apr 2005 17:50:13 +0000 (17:50 +0000)
committersof <unknown>
Fri, 22 Apr 2005 17:50:13 +0000 (17:50 +0000)
Switch to a manual-reset event for the completed-console-event object;
with auto-reset, we ran the risk of leaving it in a signalled state.

Merge to STABLE.

ghc/rts/win32/ConsoleHandler.c

index c68dc1d..4e470b3 100644 (file)
@@ -38,7 +38,7 @@ initUserSignals(void)
     if (hConsoleEvent == INVALID_HANDLE_VALUE) {
        hConsoleEvent = 
            CreateEvent ( NULL,  /* default security attributes */
-                         FALSE, /* auto-reset event */
+                         TRUE,  /* manual-reset event */
                          FALSE, /* initially non-signalled */
                          NULL); /* no name */
     }
@@ -291,7 +291,9 @@ rts_ConsoleHandlerDone(int ev)
     if ( (DWORD)ev == CTRL_BREAK_EVENT ||
         (DWORD)ev == CTRL_C_EVENT ) {
        /* only these two cause stdin system calls to abort.. */
-       SetEvent(hConsoleEvent); /* event is auto-reset */
+       SetEvent(hConsoleEvent); /* event is manual-reset */
+       Sleep(0); /* yield */
+       ResetEvent(hConsoleEvent); /* turn it back off again */
     }
 }