Skip to content

Commit 65701ad

Browse files
cherrymuitoothrot
authored andcommitted
[release-branch.go1.17] 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 #53042. Updates #52998. Change-Id: Icdcab9396d735506480ef880fb45a4669fa7cc8f Reviewed-on: https://go-review.googlesource.com/c/go/+/407888 Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Run-TryBot: Cherry Mui <[email protected]> Reviewed-by: Cuong Manh Le <[email protected]> TryBot-Result: Gopher Robot <[email protected]> (cherry picked from commit 62e1302) Reviewed-on: https://go-review.googlesource.com/c/go/+/408115
1 parent e846f3f commit 65701ad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

misc/cgo/testsanitizers/testdata/tsan12.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
import "C"
2323

2424
func main() {
25-
ch := make(chan os.Signal)
25+
ch := make(chan os.Signal, 1)
2626
signal.Notify(ch, syscall.SIGUSR1)
2727

2828
if err := exec.Command("true").Run(); err != nil {

0 commit comments

Comments
 (0)