Commit 44b7d5b4 authored by Robert Obryk's avatar Robert Obryk Committed by Brad Fitzpatrick

test/stress: fix a goroutine leak in threadRing stresstest

Fixes #5527

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/9955043
parent 4a8ef1f6
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment