Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
dffddba5
Commit
dffddba5
authored
Dec 04, 2007
by
Simon Marlow
Browse files
protect console handler against concurrent access (
#1922
)
parent
87e82c15
Changes
1
Hide whitespace changes
Inline
Side-by-side
rts/win32/ConsoleHandler.c
View file @
dffddba5
...
...
@@ -264,8 +264,13 @@ rts_InstallConsoleEvent(int action, StgStablePtr *handler)
}
break
;
case
STG_SIG_HAN
:
#ifdef THREADED_RTS
// handler is stored in an MVar in the threaded RTS
console_handler
=
STG_SIG_HAN
;
#else
console_handler
=
(
StgInt
)
*
handler
;
if
(
previous_hdlr
<
0
)
{
#endif
if
(
previous_hdlr
<
0
||
previous_hdlr
==
STG_SIG_HAN
)
{
/* Only install generic_handler() once */
if
(
!
SetConsoleCtrlHandler
(
generic_handler
,
TRUE
)
)
{
errorBelch
(
"warning: unable to install console event handler"
);
...
...
@@ -275,10 +280,13 @@ rts_InstallConsoleEvent(int action, StgStablePtr *handler)
}
if
(
previous_hdlr
==
STG_SIG_DFL
||
previous_hdlr
==
STG_SIG_IGN
)
{
previous_hdlr
==
STG_SIG_IGN
||
previous_hdlr
==
STG_SIG_HAN
)
{
return
previous_hdlr
;
}
else
{
*
handler
=
(
StgStablePtr
)
previous_hdlr
;
if
(
handler
!=
NULL
)
{
*
handler
=
(
StgStablePtr
)
previous_hdlr
;
}
return
STG_SIG_HAN
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment