mirror of
https://github.com/panjf2000/ants.git
synced 2025-12-16 18:11:03 +00:00
parent
e7e3c844aa
commit
99121e2404
5
pool.go
5
pool.go
@ -110,10 +110,7 @@ func (p *Pool) purgeStaleWorkers() {
|
|||||||
isDormant = n == 0 || n == len(staleWorkers)
|
isDormant = n == 0 || n == len(staleWorkers)
|
||||||
p.lock.Unlock()
|
p.lock.Unlock()
|
||||||
|
|
||||||
// Notify obsolete workers to stop.
|
// Clean up the stale workers.
|
||||||
// This notification must be outside the p.lock, since w.task
|
|
||||||
// may be blocking and may consume a lot of time if many workers
|
|
||||||
// are located on non-local CPUs.
|
|
||||||
for i := range staleWorkers {
|
for i := range staleWorkers {
|
||||||
staleWorkers[i].finish()
|
staleWorkers[i].finish()
|
||||||
staleWorkers[i] = nil
|
staleWorkers[i] = nil
|
||||||
|
|||||||
@ -67,10 +67,7 @@ func (p *PoolWithFunc) purgeStaleWorkers() {
|
|||||||
isDormant = n == 0 || n == len(staleWorkers)
|
isDormant = n == 0 || n == len(staleWorkers)
|
||||||
p.lock.Unlock()
|
p.lock.Unlock()
|
||||||
|
|
||||||
// Notify obsolete workers to stop.
|
// Clean up the stale workers.
|
||||||
// This notification must be outside the p.lock, since w.task
|
|
||||||
// may be blocking and may consume a lot of time if many workers
|
|
||||||
// are located on non-local CPUs.
|
|
||||||
for i := range staleWorkers {
|
for i := range staleWorkers {
|
||||||
staleWorkers[i].finish()
|
staleWorkers[i].finish()
|
||||||
staleWorkers[i] = nil
|
staleWorkers[i] = nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user