From e01348e424eea2121130e1108164c68c6556744a Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Fri, 19 Mar 2021 01:21:14 +0800 Subject: [PATCH] Fix a bug from the previous commit Updates #141 --- pool.go | 2 +- pool_func.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pool.go b/pool.go index 986ee20..e27d586 100644 --- a/pool.go +++ b/pool.go @@ -244,8 +244,8 @@ func (p *Pool) retrieveWorker() (w *goWorker) { p.cond.Wait() p.blockingNum-- if p.Running() == 0 { + p.lock.Unlock() if !p.IsClosed() { - p.lock.Unlock() spawnWorker() } return diff --git a/pool_func.go b/pool_func.go index 4ca2acb..3d77487 100644 --- a/pool_func.go +++ b/pool_func.go @@ -262,8 +262,8 @@ func (p *PoolWithFunc) retrieveWorker() (w *goWorkerWithFunc) { p.cond.Wait() p.blockingNum-- if p.Running() == 0 { + p.lock.Unlock() if !p.IsClosed() { - p.lock.Unlock() spawnWorker() } return