From: Patrik Nyblom Date: Tue, 16 Nov 2021 22:35:59 +0000 (-0800) Subject: runtime: make sure to properly park before going to sleep in Windows ConsoleControlHa... X-Git-Tag: go1.18beta1~271 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=54b9cb80372f45b5e86c5246717c766fac6f1fe6;p=gostls13.git 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 Trust: Dan Scales Run-TryBot: Patrik Nyblom Run-TryBot: Cherry Mui Reviewed-by: Cherry Mui Reviewed-by: Michael Knyszek TryBot-Result: Go Bot --- diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go index 648239fb36..7ffb3a11b5 100644 --- a/src/runtime/os_windows.go +++ b/src/runtime/os_windows.go @@ -1194,8 +1194,10 @@ func ctrlHandler(_type uint32) uintptr { if sigsend(s) { if s == _SIGTERM { // Windows terminates the process after this handler returns. - // Block indefinitely to give signal handlers a chance to clean up. - stdcall1(_Sleep, uintptr(_INFINITE)) + // Block indefinitely to give signal handlers a chance to clean up, + // but make sure to be properly parked first, so the rest of the + // program can continue executing. + block() } return 1 }