mirror of https://github.com/panjf2000/ants.git
fix multi goroutine unlock after add running cause cap > p.running not correct
This commit is contained in:
parent
1217e3eabe
commit
6ea46de8d3
2
pool.go
2
pool.go
|
@ -383,9 +383,9 @@ retry:
|
|||
// If the worker queue is empty, and we don't run out of the pool capacity,
|
||||
// then just spawn a new worker goroutine.
|
||||
if capacity := p.Cap(); capacity == -1 || capacity > p.Running() {
|
||||
p.lock.Unlock()
|
||||
w = p.workerCache.Get().(*goWorker)
|
||||
w.run()
|
||||
p.lock.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue