forked from mirror/ants
fixed 清理过期协程报错 #7
This commit is contained in:
parent
7a2f4e4681
commit
62fc58f047
2
pool.go
2
pool.go
|
@ -75,8 +75,8 @@ func (p *Pool) periodicallyPurge() {
|
|||
w.task <- nil
|
||||
idleWorkers[i] = nil
|
||||
}
|
||||
n++
|
||||
if n > 0 {
|
||||
n++
|
||||
p.workers = idleWorkers[n:]
|
||||
}
|
||||
p.lock.Unlock()
|
||||
|
|
|
@ -77,8 +77,8 @@ func (p *PoolWithFunc) periodicallyPurge() {
|
|||
w.args <- nil
|
||||
idleWorkers[i] = nil
|
||||
}
|
||||
n++
|
||||
if n > 0 {
|
||||
n++
|
||||
p.workers = idleWorkers[n:]
|
||||
}
|
||||
p.lock.Unlock()
|
||||
|
|
Loading…
Reference in New Issue