defer release pool

This commit is contained in:
andy pan 2018-07-02 14:39:31 +08:00
parent cca93c8dfc
commit 8ad523ca08
1 changed files with 2 additions and 2 deletions

View File

@ -83,7 +83,7 @@ func BenchmarkAntsPoolWithFunc(b *testing.B) {
wg.Done() wg.Done()
return nil return nil
}) })
p.Release() defer p.Release()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
for j := 0; j < RunTimes; j++ { for j := 0; j < RunTimes; j++ {
@ -105,7 +105,7 @@ func BenchmarkGoroutine(b *testing.B) {
func BenchmarkAntsPool(b *testing.B) { func BenchmarkAntsPool(b *testing.B) {
p, _ := ants.NewPoolWithFunc(50000, demoPoolFunc) p, _ := ants.NewPoolWithFunc(50000, demoPoolFunc)
p.Release() defer p.Release()
b.ResetTimer() b.ResetTimer()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {