mirror of https://github.com/panjf2000/ants.git
fix: resolve the build failures
This commit is contained in:
parent
b6eaea118b
commit
88d2454bbb
8
pool.go
8
pool.go
|
@ -286,12 +286,14 @@ func (p *Pool) Release() {
|
|||
|
||||
// ReleaseTimeout is like Release but with a timeout, it waits all workers to exit before timing out.
|
||||
func (p *Pool) ReleaseTimeout(timeout time.Duration) error {
|
||||
if p.IsClosed() || p.stopPurge == nil || p.stopTicktock == nil {
|
||||
if p.IsClosed() || (!p.options.DisablePurge && p.stopPurge == nil) || p.stopTicktock == nil {
|
||||
return ErrPoolClosed
|
||||
}
|
||||
|
||||
p.stopPurge()
|
||||
p.stopPurge = nil
|
||||
if p.stopPurge != nil {
|
||||
p.stopPurge()
|
||||
p.stopPurge = nil
|
||||
}
|
||||
p.stopTicktock()
|
||||
p.stopTicktock = nil
|
||||
p.Release()
|
||||
|
|
|
@ -315,12 +315,14 @@ func (p *PoolWithFunc) Release() {
|
|||
|
||||
// ReleaseTimeout is like Release but with a timeout, it waits all workers to exit before timing out.
|
||||
func (p *PoolWithFunc) ReleaseTimeout(timeout time.Duration) error {
|
||||
if p.IsClosed() || p.stopPurge == nil || p.stopTicktock == nil {
|
||||
if p.IsClosed() || (!p.options.DisablePurge && p.stopPurge == nil) || p.stopTicktock == nil {
|
||||
return ErrPoolClosed
|
||||
}
|
||||
|
||||
p.stopPurge()
|
||||
p.stopPurge = nil
|
||||
if p.stopPurge != nil {
|
||||
p.stopPurge()
|
||||
p.stopPurge = nil
|
||||
}
|
||||
p.stopTicktock()
|
||||
p.stopTicktock = nil
|
||||
p.Release()
|
||||
|
|
Loading…
Reference in New Issue