From e64217c3643dcd08d5cde20a736c21334d9d7caf Mon Sep 17 00:00:00 2001 From: andy pan Date: Fri, 22 Jun 2018 11:42:05 +0800 Subject: [PATCH] optimization for releasing pool --- pool.go | 3 +++ pool_func.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/pool.go b/pool.go index 72fc7e2..003b11d 100644 --- a/pool.go +++ b/pool.go @@ -106,6 +106,9 @@ func (p *Pool) Release() error { for i := 0; i < running; i++ { p.getWorker().stop() } + for i := range p.workers{ + p.workers[i] = nil + } }) return nil } diff --git a/pool_func.go b/pool_func.go index 74d1eb4..8739feb 100644 --- a/pool_func.go +++ b/pool_func.go @@ -111,6 +111,9 @@ func (p *PoolWithFunc) Release() error { for i := 0; i < running; i++ { p.getWorker().stop() } + for i := range p.workers{ + p.workers[i] = nil + } }) return nil }