]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.14] runtime: detect services in signal handler
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 14 Jul 2020 07:41:03 +0000 (01:41 -0600)
committerDmitri Shuralyov <dmitshur@golang.org>
Sat, 22 Aug 2020 03:58:04 +0000 (03:58 +0000)
commit7456a4618f064c27c511bbed87c887b116fb5ea1
tree343ff6d1e97e40d662819f734448aa6f3112a555
parent17fd967e3b99c370eb52541b3b6108880f450d5b
[release-branch.go1.14] runtime: detect services in signal handler

The service handler needs to handle CTRL+C-like events -- including
those sent by the service manager itself -- using the default Windows
implementation if no signal handler from Go is already listening to
those events. Ordinarily, the signal handler would call exit(2), but we
actually need to allow this to be passed onward to the service handler.
So, we detect if we're in a service and skip calling exit(2) in that
case, just like we do for shared libraries.

Updates #40167.
Updates #40074.
Fixes #40411.

Change-Id: Ia77871737a80e1e94f85b02d26af1fd2f646af96
Reviewed-on: https://go-review.googlesource.com/c/go/+/244958
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
src/runtime/os_windows.go