]> Cypherpunks repositories - gostls13.git/commit
os/signal: avoid race between Stop and receiving on channel
authorIan Lance Taylor <iant@golang.org>
Fri, 16 Jun 2017 16:29:44 +0000 (09:29 -0700)
committerIan Lance Taylor <iant@golang.org>
Sat, 24 Jun 2017 00:54:01 +0000 (00:54 +0000)
commit8ec7a39fec2acab98ce5e41363dd1c65c03d7479
treea58f6b41ae0903da4db8a2f9b488000ab1d218aa
parent3785457c765018a8ca5a399da177ddc5573db68d
os/signal: avoid race between Stop and receiving on channel

When Stop is called on a channel, wait until all signals have been
delivered to the channel before returning.

Use atomic operations in sigqueue to communicate more reliably between
the os/signal goroutine and the signal handler.

Fixes #14571

Change-Id: I6c5a9eea1cff85e37a34dffe96f4bb2699e12c6e
Reviewed-on: https://go-review.googlesource.com/46003
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/os/signal/signal.go
src/os/signal/signal_test.go
src/runtime/sigqueue.go
src/runtime/sigqueue_plan9.go