aboutsummaryrefslogtreecommitdiff
path: root/test/stress
diff options
context:
space:
mode:
authorRobert Obryk <robryk@gmail.com>2013-06-03 07:07:31 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2013-06-03 07:07:31 -0700
commit44b7d5b41a0dd9e559ea191e79e85c310f8f0716 (patch)
tree85e819b70dc0e0170181556b6dcb0da4c169d9d8 /test/stress
parent4a8ef1f65db072ecd6ff79201338ac75b43640fa (diff)
downloadgo-44b7d5b41a0dd9e559ea191e79e85c310f8f0716.tar.gz
go-44b7d5b41a0dd9e559ea191e79e85c310f8f0716.zip
test/stress: fix a goroutine leak in threadRing stresstest
Fixes #5527 R=golang-dev, dvyukov CC=golang-dev https://golang.org/cl/9955043
Diffstat (limited to 'test/stress')
-rw-r--r--test/stress/runstress.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/stress/runstress.go b/test/stress/runstress.go
index b5adf6a4a5..76ab2a8b4f 100644
--- a/test/stress/runstress.go
+++ b/test/stress/runstress.go
@@ -114,11 +114,16 @@ func stressExec() {
}
}
-func ringf(in <-chan int, out chan<- int, donec chan<- bool) {
+func ringf(in <-chan int, out chan<- int, donec chan bool) {
for {
- n := <-in
+ var n int
+ select {
+ case <-donec:
+ return
+ case n = <-in:
+ }
if n == 0 {
- donec <- true
+ close(donec)
return
}
out <- n - 1