🍻Refine the `Pool.Release()` Method

This commit is contained in:
Andy Pan 2019-08-19 16:35:58 +08:00
parent 444711e79f
commit d1b4e8b163
2 changed files with 2 additions and 4 deletions

View File

@ -200,7 +200,7 @@ func (p *Pool) Tune(size int) {
} }
// Release Closes this pool. // Release Closes this pool.
func (p *Pool) Release() error { func (p *Pool) Release() {
p.once.Do(func() { p.once.Do(func() {
atomic.StoreInt32(&p.release, 1) atomic.StoreInt32(&p.release, 1)
p.lock.Lock() p.lock.Lock()
@ -212,7 +212,6 @@ func (p *Pool) Release() error {
p.workers = nil p.workers = nil
p.lock.Unlock() p.lock.Unlock()
}) })
return nil
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -205,7 +205,7 @@ func (p *PoolWithFunc) Tune(size int) {
} }
// Release Closed this pool. // Release Closed this pool.
func (p *PoolWithFunc) Release() error { func (p *PoolWithFunc) Release() {
p.once.Do(func() { p.once.Do(func() {
atomic.StoreInt32(&p.release, 1) atomic.StoreInt32(&p.release, 1)
p.lock.Lock() p.lock.Lock()
@ -217,7 +217,6 @@ func (p *PoolWithFunc) Release() error {
p.workers = nil p.workers = nil
p.lock.Unlock() p.lock.Unlock()
}) })
return nil
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------