From d1b4e8b1632fef4794dffcf64a1517bbcc523234 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Mon, 19 Aug 2019 16:35:58 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=BBRefine=20the=20`Pool.Release()`=20M?= =?UTF-8?q?ethod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pool.go | 3 +-- pool_func.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pool.go b/pool.go index d2b817d..b51456f 100644 --- a/pool.go +++ b/pool.go @@ -200,7 +200,7 @@ func (p *Pool) Tune(size int) { } // Release Closes this pool. -func (p *Pool) Release() error { +func (p *Pool) Release() { p.once.Do(func() { atomic.StoreInt32(&p.release, 1) p.lock.Lock() @@ -212,7 +212,6 @@ func (p *Pool) Release() error { p.workers = nil p.lock.Unlock() }) - return nil } //--------------------------------------------------------------------------- diff --git a/pool_func.go b/pool_func.go index e8a8f00..c772de6 100644 --- a/pool_func.go +++ b/pool_func.go @@ -205,7 +205,7 @@ func (p *PoolWithFunc) Tune(size int) { } // Release Closed this pool. -func (p *PoolWithFunc) Release() error { +func (p *PoolWithFunc) Release() { p.once.Do(func() { atomic.StoreInt32(&p.release, 1) p.lock.Lock() @@ -217,7 +217,6 @@ func (p *PoolWithFunc) Release() error { p.workers = nil p.lock.Unlock() }) - return nil } //---------------------------------------------------------------------------