forked from mirror/ants
fix: resolve the build failures
This commit is contained in:
parent
b6eaea118b
commit
88d2454bbb
4
pool.go
4
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.
|
// 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 {
|
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
|
return ErrPoolClosed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.stopPurge != nil {
|
||||||
p.stopPurge()
|
p.stopPurge()
|
||||||
p.stopPurge = nil
|
p.stopPurge = nil
|
||||||
|
}
|
||||||
p.stopTicktock()
|
p.stopTicktock()
|
||||||
p.stopTicktock = nil
|
p.stopTicktock = nil
|
||||||
p.Release()
|
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.
|
// 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 {
|
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
|
return ErrPoolClosed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.stopPurge != nil {
|
||||||
p.stopPurge()
|
p.stopPurge()
|
||||||
p.stopPurge = nil
|
p.stopPurge = nil
|
||||||
|
}
|
||||||
p.stopTicktock()
|
p.stopTicktock()
|
||||||
p.stopTicktock = nil
|
p.stopTicktock = nil
|
||||||
p.Release()
|
p.Release()
|
||||||
|
|
Loading…
Reference in New Issue