This commit is contained in:
Andy Pan 2018-07-06 20:24:47 +08:00
parent 339aaa4475
commit 6da1112dff
5 changed files with 19 additions and 21 deletions

View File

@ -68,4 +68,3 @@ var (
ErrPoolSizeInvalid = errors.New("invalid size for pool")
ErrPoolClosed = errors.New("this pool has been closed")
)

View File

@ -78,7 +78,7 @@ func BenchmarkGoroutineWithFunc(b *testing.B) {
func BenchmarkAntsPoolWithFunc(b *testing.B) {
var wg sync.WaitGroup
p, _ := ants.NewPoolWithFunc(50000, 1,func(i interface{}) error {
p, _ := ants.NewPoolWithFunc(50000, 1, func(i interface{}) error {
demoPoolFunc(i)
wg.Done()
return nil

View File

@ -87,7 +87,6 @@ func (p *Pool) monitorAndClear() {
}()
}
// NewPool generates a instance of ants pool
func NewPool(size, expiry int) (*Pool, error) {
if size <= 0 {
@ -138,7 +137,7 @@ func (p *Pool) Release() error {
for i := 0; i < running; i++ {
p.getWorker().stop()
}
for i := range p.workers{
for i := range p.workers {
p.workers[i] = nil
}
})

View File

@ -142,7 +142,7 @@ func (p *PoolWithFunc) Release() error {
for i := 0; i < running; i++ {
p.getWorker().stop()
}
for i := range p.workers{
for i := range p.workers {
p.workers[i] = nil
}
})