aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/os_windows.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/os_windows.go')
-rw-r--r--src/runtime/os_windows.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go
index 83d0d63e5d..e6b22e3167 100644
--- a/src/runtime/os_windows.go
+++ b/src/runtime/os_windows.go
@@ -46,6 +46,7 @@ const (
//go:cgo_import_dynamic runtime._SetThreadPriority SetThreadPriority%2 "kernel32.dll"
//go:cgo_import_dynamic runtime._SetUnhandledExceptionFilter SetUnhandledExceptionFilter%1 "kernel32.dll"
//go:cgo_import_dynamic runtime._SetWaitableTimer SetWaitableTimer%6 "kernel32.dll"
+//go:cgo_import_dynamic runtime._Sleep Sleep%1 "kernel32.dll"
//go:cgo_import_dynamic runtime._SuspendThread SuspendThread%1 "kernel32.dll"
//go:cgo_import_dynamic runtime._SwitchToThread SwitchToThread%0 "kernel32.dll"
//go:cgo_import_dynamic runtime._TlsAlloc TlsAlloc%0 "kernel32.dll"
@@ -97,6 +98,7 @@ var (
_SetThreadPriority,
_SetUnhandledExceptionFilter,
_SetWaitableTimer,
+ _Sleep,
_SuspendThread,
_SwitchToThread,
_TlsAlloc,
@@ -1094,6 +1096,11 @@ func ctrlhandler1(_type uint32) uint32 {
}
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))
+ }
return 1
}
return 0