mirror of
https://github.com/golang/go
synced 2024-10-06 08:00:07 +00:00
test/stress: fix a goroutine leak in threadRing stresstest
Fixes #5527 R=golang-dev, dvyukov CC=golang-dev https://golang.org/cl/9955043
This commit is contained in:
parent
4a8ef1f65d
commit
44b7d5b41a
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue