diff --git a/pool.go b/pool.go index 33e46ed..2106e83 100644 --- a/pool.go +++ b/pool.go @@ -110,10 +110,7 @@ func (p *Pool) purgeStaleWorkers() { isDormant = n == 0 || n == len(staleWorkers) p.lock.Unlock() - // Notify obsolete workers to stop. - // 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. + // Clean up the stale workers. for i := range staleWorkers { staleWorkers[i].finish() staleWorkers[i] = nil diff --git a/pool_func.go b/pool_func.go index 140d5fe..2954106 100644 --- a/pool_func.go +++ b/pool_func.go @@ -67,10 +67,7 @@ func (p *PoolWithFunc) purgeStaleWorkers() { isDormant = n == 0 || n == len(staleWorkers) p.lock.Unlock() - // Notify obsolete workers to stop. - // 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. + // Clean up the stale workers. for i := range staleWorkers { staleWorkers[i].finish() staleWorkers[i] = nil