Skip to content

Commit 54b9cb8

Browse files
committed
runtime: make sure to properly park before going to sleep in Windows ConsoleControlHandler
This change avoids the program intermittently hanging on windows/arm64 after getting a signal for which the ConsoleControlHandler can not return. Fixes #49458 Change-Id: Ie28f0f437c7e0f9634b6b3e29dc6cdebd5d996f6 Reviewed-on: https://go-review.googlesource.com/c/go/+/364556 Trust: Patrik Nyblom <[email protected]> Trust: Dan Scales <[email protected]> Run-TryBot: Patrik Nyblom <[email protected]> Run-TryBot: Cherry Mui <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> TryBot-Result: Go Bot <[email protected]>
1 parent 4083a6f commit 54b9cb8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/runtime/os_windows.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,8 +1194,10 @@ func ctrlHandler(_type uint32) uintptr {
11941194
if sigsend(s) {
11951195
if s == _SIGTERM {
11961196
// Windows terminates the process after this handler returns.
1197-
// Block indefinitely to give signal handlers a chance to clean up.
1198-
stdcall1(_Sleep, uintptr(_INFINITE))
1197+
// Block indefinitely to give signal handlers a chance to clean up,
1198+
// but make sure to be properly parked first, so the rest of the
1199+
// program can continue executing.
1200+
block()
11991201
}
12001202
return 1
12011203
}

0 commit comments

Comments
 (0)