mirror of https://github.com/panjf2000/ants.git
🍻Refine the `Pool.Release()` Method
This commit is contained in:
parent
444711e79f
commit
d1b4e8b163
3
pool.go
3
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
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue