mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: don't block signals that will kill the program
Otherwise we may delay the delivery of these signals for an arbitrary length of time. We are already careful to not block signals that the program has asked to see. Also make sure that we don't miss a signal delivery if a thread decides to stop for a while while executing the signal handler. Also clean up the TestAtomicStop output a little bit. Fixes #21433 Change-Id: Ic0c1a4eaf7eba80d1abc1e9537570bf4687c2434 Reviewed-on: https://go-review.googlesource.com/79581 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
b23096b514
commit
eb97160f46
4 changed files with 50 additions and 13 deletions
|
|
@ -321,7 +321,9 @@ func TestAtomicStop(t *testing.T) {
|
|||
cmd.Env = append(os.Environ(), "GO_TEST_ATOMIC_STOP=1")
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err == nil {
|
||||
t.Logf("iteration %d: output %s", i, out)
|
||||
if len(out) > 0 {
|
||||
t.Logf("iteration %d: output %s", i, out)
|
||||
}
|
||||
} else {
|
||||
t.Logf("iteration %d: exit status %q: output: %s", i, err, out)
|
||||
}
|
||||
|
|
@ -378,7 +380,7 @@ func atomicStopTestProgram() {
|
|||
case <-cs:
|
||||
case <-time.After(1 * time.Second):
|
||||
if !printed {
|
||||
fmt.Print("lost signal on iterations:")
|
||||
fmt.Print("lost signal on tries:")
|
||||
printed = true
|
||||
}
|
||||
fmt.Printf(" %d", i)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue