forked from mirror/ants
optimization for releasing pool
This commit is contained in:
parent
c74267de7d
commit
e64217c364
3
pool.go
3
pool.go
|
@ -106,6 +106,9 @@ func (p *Pool) Release() error {
|
||||||
for i := 0; i < running; i++ {
|
for i := 0; i < running; i++ {
|
||||||
p.getWorker().stop()
|
p.getWorker().stop()
|
||||||
}
|
}
|
||||||
|
for i := range p.workers{
|
||||||
|
p.workers[i] = nil
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,9 @@ func (p *PoolWithFunc) Release() error {
|
||||||
for i := 0; i < running; i++ {
|
for i := 0; i < running; i++ {
|
||||||
p.getWorker().stop()
|
p.getWorker().stop()
|
||||||
}
|
}
|
||||||
|
for i := range p.workers{
|
||||||
|
p.workers[i] = nil
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue