]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.15] 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:57:10 +0000 (03:57 +0000)
commitb1253d24e159129c778377c3a2a0bde15904a417
treeed018e5014cd0453aee3500b17426ea99a829ded
parent8bf83b323cb5542ac3c41394a4bb1d3ae115c640
[release-branch.go1.15] 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 #40412.

Change-Id: Ia77871737a80e1e94f85b02d26af1fd2f646af96
Reviewed-on: https://go-review.googlesource.com/c/go/+/244959
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