mirror of https://github.com/panjf2000/ants.git
update
This commit is contained in:
parent
8ff88950b8
commit
5c30d8f881
3
pool.go
3
pool.go
|
@ -97,6 +97,8 @@ func (p *Pool) newWorker() *Worker {
|
|||
func (p *Pool) getWorker() *Worker {
|
||||
var worker *Worker
|
||||
if p.reachLimit() {
|
||||
worker = <-p.workers
|
||||
} else {
|
||||
select {
|
||||
case worker = <-p.workers:
|
||||
return worker
|
||||
|
@ -104,6 +106,5 @@ func (p *Pool) getWorker() *Worker {
|
|||
worker = p.newWorker()
|
||||
}
|
||||
}
|
||||
worker = <-p.workers
|
||||
return worker
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue