mirror of
https://github.com/panjf2000/ants.git
synced 2025-12-16 18:11:03 +00:00
update
This commit is contained in:
parent
8ff88950b8
commit
5c30d8f881
7
pool.go
7
pool.go
@ -97,13 +97,14 @@ func (p *Pool) newWorker() *Worker {
|
|||||||
func (p *Pool) getWorker() *Worker {
|
func (p *Pool) getWorker() *Worker {
|
||||||
var worker *Worker
|
var worker *Worker
|
||||||
if p.reachLimit() {
|
if p.reachLimit() {
|
||||||
|
worker = <-p.workers
|
||||||
|
} else {
|
||||||
select {
|
select {
|
||||||
case worker = <-p.workers:
|
case worker = <-p.workers:
|
||||||
return worker
|
return worker
|
||||||
default:
|
default:
|
||||||
worker = p.newWorker()
|
worker = p.newWorker()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
worker = <-p.workers
|
|
||||||
return worker
|
return worker
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user