fix multi goroutine unlock after add running cause cap > p.running not correct

This commit is contained in:
CyanChan 2024-07-21 00:43:57 +08:00 committed by GitHub
parent 1217e3eabe
commit 6ea46de8d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -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
}