From 904e1d6721f405a0c6fead4009472189593a897e Mon Sep 17 00:00:00 2001 From: sof Date: Tue, 21 Oct 2003 03:38:07 +0000 Subject: [PATCH] [project @ 2003-10-21 03:38:07 by sof] stg_InstallConsoleEvent(): registering generic_handler() once will do --- ghc/rts/win32/ConsoleHandler.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ghc/rts/win32/ConsoleHandler.c b/ghc/rts/win32/ConsoleHandler.c index c8ef67d..6dc9ce4 100644 --- a/ghc/rts/win32/ConsoleHandler.c +++ b/ghc/rts/win32/ConsoleHandler.c @@ -83,7 +83,6 @@ void initDefaultHandlers(void) if ( !SetConsoleCtrlHandler(shutdown_handler, TRUE) ) { prog_belch("warning: failed to install default console handler"); } - } @@ -221,8 +220,11 @@ stg_InstallConsoleEvent(int action, StgStablePtr *handler) break; case STG_SIG_HAN: console_handler = (StgInt)*handler; - if ( !SetConsoleCtrlHandler(generic_handler, TRUE) ) { + if ( previous_hdlr < 0 ) { + /* Only install generic_handler() once */ + if ( !SetConsoleCtrlHandler(generic_handler, TRUE) ) { prog_belch("warning: unable to install console event handler"); + } } break; } -- 1.7.10.4