Skip to content

Commit 927af81

Browse files
authored
Console CtrlHandler routine should block
Fixes #41884.
1 parent 71bbffb commit 927af81

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/runtime/os_windows.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const (
4545
//go:cgo_import_dynamic runtime._SetThreadPriority SetThreadPriority%2 "kernel32.dll"
4646
//go:cgo_import_dynamic runtime._SetUnhandledExceptionFilter SetUnhandledExceptionFilter%1 "kernel32.dll"
4747
//go:cgo_import_dynamic runtime._SetWaitableTimer SetWaitableTimer%6 "kernel32.dll"
48+
//go:cgo_import_dynamic runtime._Sleep Sleep%1 "kernel32.dll"
4849
//go:cgo_import_dynamic runtime._SuspendThread SuspendThread%1 "kernel32.dll"
4950
//go:cgo_import_dynamic runtime._SwitchToThread SwitchToThread%0 "kernel32.dll"
5051
//go:cgo_import_dynamic runtime._TlsAlloc TlsAlloc%0 "kernel32.dll"
@@ -95,6 +96,7 @@ var (
9596
_SetThreadPriority,
9697
_SetUnhandledExceptionFilter,
9798
_SetWaitableTimer,
99+
_Sleep,
98100
_SuspendThread,
99101
_SwitchToThread,
100102
_TlsAlloc,
@@ -1029,6 +1031,7 @@ func ctrlhandler1(_type uint32) uint32 {
10291031
}
10301032

10311033
if sigsend(s) {
1034+
stdcall1(_Sleep, uintptr(_INFINITE))
10321035
return 1
10331036
}
10341037
exit(2) // SIGINT, SIGTERM, etc

0 commit comments

Comments
 (0)