diff options
| author | Emmanuel T Odeke <emmanuel@orijtech.com> | 2019-03-11 10:52:00 -0700 |
|---|---|---|
| committer | Emmanuel Odeke <emm.odeke@gmail.com> | 2019-10-02 03:52:59 +0000 |
| commit | e79b57d6c40a25393b2d831b244b19548e23b8a4 (patch) | |
| tree | 4f8d837a71a1a4be212ce63c83c1d2117a80a27f /src/runtime/testdata | |
| parent | a1b0af9904e3cc1cd169da7f0e5ad81420cd728e (diff) | |
| download | go-e79b57d6c40a25393b2d831b244b19548e23b8a4.tar.xz | |
os/signal: lazily start signal watch loop only on Notify
By lazily starting the signal watch loop only on Notify,
we are able to have deadlock detection even when
"os/signal" is imported.
Thanks to Ian Lance Taylor for the solution and discussion.
With this change in, fix a runtime gorountine count test that
assumed that os/signal.init would unconditionally start the
signal watching goroutine, but alas no more.
Fixes #21576.
Change-Id: I6eecf82a887f59f2ec8897f1bcd67ca311ca42ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/101036
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/testdata')
| -rw-r--r-- | src/runtime/testdata/testprogcgo/numgoroutine.go | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/src/runtime/testdata/testprogcgo/numgoroutine.go b/src/runtime/testdata/testprogcgo/numgoroutine.go index 12fda49a13..5bdfe52ed4 100644 --- a/src/runtime/testdata/testprogcgo/numgoroutine.go +++ b/src/runtime/testdata/testprogcgo/numgoroutine.go @@ -41,13 +41,6 @@ func NumGoroutine() { // Test that there are just the expected number of goroutines // running. Specifically, test that the spare M's goroutine // doesn't show up. - // - // On non-Windows platforms there's a signal handling thread - // started by os/signal.init in addition to the main - // goroutine. - if runtime.GOOS != "windows" { - baseGoroutines = 1 - } if _, ok := checkNumGoroutine("first", 1+baseGoroutines); !ok { return } |
