aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2022-05-23 20:20:07 -0400
committerAlex Rakoczy <alex@golang.org>2022-05-25 19:25:08 +0000
commit04337a6d10363a45ba5accfc8f323b01f9911295 (patch)
tree496c2379072a01d496018a0b2acefef9a54e0a53
parentcf5fa2b4a7b4325cf88a51c36b5fe37837e3a158 (diff)
downloadgo-04337a6d10363a45ba5accfc8f323b01f9911295.tar.gz
go-04337a6d10363a45ba5accfc8f323b01f9911295.zip
[release-branch.go1.18] misc/cgo/testsanitizers: use buffered channel in tsan12.go
os/signal.Notify requires that "the caller must ensure that c has sufficient buffer space to keep up with the expected signal rate" as it does a nonblocking send when it receives a signal. The test currently using a unbuffered channel, which means it may miss the signal if the signal arrives before the channel receive operation. Fixes #53043. Updates #52998. Change-Id: Icdcab9396d735506480ef880fb45a4669fa7cc8f Reviewed-on: https://go-review.googlesource.com/c/go/+/407888 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> (cherry picked from commit 62e130226767a088ace196da90a774c9a9d14689) Reviewed-on: https://go-review.googlesource.com/c/go/+/408114
-rw-r--r--misc/cgo/testsanitizers/testdata/tsan12.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/misc/cgo/testsanitizers/testdata/tsan12.go b/misc/cgo/testsanitizers/testdata/tsan12.go
index 3e767eee1f..0ef545d09b 100644
--- a/misc/cgo/testsanitizers/testdata/tsan12.go
+++ b/misc/cgo/testsanitizers/testdata/tsan12.go
@@ -22,7 +22,7 @@ import (
import "C"
func main() {
- ch := make(chan os.Signal)
+ ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGUSR1)
if err := exec.Command("true").Run(); err != nil {