From 87b15034c59fbd3340a67ebeae1e30b8ca5b54fb Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Sat, 4 Aug 2018 09:42:25 +0800 Subject: [PATCH] optimization for default pool --- ants.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/ants.go b/ants.go index 6b3d51c..2e018e8 100644 --- a/ants.go +++ b/ants.go @@ -48,15 +48,6 @@ func init() { } } -// Release Closed the default pool -func Release() { - defaultAntsPool.Release() - defaultAntsPool, err = NewPool(DefaultAntsPoolSize) - if err != nil { - panic(err) - } -} - // Submit submit a task to pool func Submit(task f) error { return defaultAntsPool.Submit(task) @@ -77,6 +68,11 @@ func Free() int { return defaultAntsPool.Free() } +// Release Closed the default pool +func Release() { + defaultAntsPool.Release() +} + // Errors for the Ants API var ( ErrInvalidPoolSize = errors.New("invalid size for pool")