From: Robert Obryk Date: Mon, 3 Jun 2013 14:07:31 +0000 (-0700) Subject: test/stress: fix a goroutine leak in threadRing stresstest X-Git-Tag: go1.2rc2~1342 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=44b7d5b41a0dd9e559ea191e79e85c310f8f0716;p=gostls13.git test/stress: fix a goroutine leak in threadRing stresstest Fixes #5527 R=golang-dev, dvyukov CC=golang-dev https://golang.org/cl/9955043 --- 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