🦅 Fix a bug when using sync.Pool

This commit is contained in:
Andy Pan 2019-01-27 05:09:39 +08:00
parent 822158c59c
commit 91377c898b
2 changed files with 2 additions and 2 deletions

View File

@ -207,8 +207,8 @@ func (p *Pool) retrieveWorker() *Worker {
pool: p, pool: p,
task: make(chan f, workerChanCap), task: make(chan f, workerChanCap),
} }
w.run()
} }
w.run()
} else { } else {
for { for {
p.cond.Wait() p.cond.Wait()

View File

@ -211,8 +211,8 @@ func (p *PoolWithFunc) retrieveWorker() *WorkerWithFunc {
pool: p, pool: p,
args: make(chan interface{}, workerChanCap), args: make(chan interface{}, workerChanCap),
} }
w.run()
} }
w.run()
} else { } else {
for { for {
p.cond.Wait() p.cond.Wait()