From 71faec8c1a2b5b4114dbca77d1ed43c8d8f55960 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Fri, 26 Jul 2019 23:52:05 +0800 Subject: [PATCH] =?UTF-8?q?=E2=98=84=EF=B8=8FRename=20the=20function=20wit?= =?UTF-8?q?h=20the=20more=20applicable=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ants_test.go | 8 ++++---- pool.go | 8 ++++---- pool_func.go | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ants_test.go b/ants_test.go index af7562b..8c2fa43 100644 --- a/ants_test.go +++ b/ants_test.go @@ -417,13 +417,13 @@ func TestPurgePreMalloc(t *testing.T) { } func TestRestCodeCoverage(t *testing.T) { - _, err := ants.NewTimingPool(-1, -1, false) + _, err := ants.NewUltimatePool(-1, -1, false) t.Log(err) - _, err = ants.NewTimingPool(1, -1, false) + _, err = ants.NewUltimatePool(1, -1, false) t.Log(err) - _, err = ants.NewTimingPoolWithFunc(-1, -1, demoPoolFunc, false) + _, err = ants.NewUltimatePoolWithFunc(-1, -1, demoPoolFunc, false) t.Log(err) - _, err = ants.NewTimingPoolWithFunc(1, -1, demoPoolFunc, false) + _, err = ants.NewUltimatePoolWithFunc(1, -1, demoPoolFunc, false) t.Log(err) p0, _ := ants.NewPool(TestSize) diff --git a/pool.go b/pool.go index e561c76..65bde25 100644 --- a/pool.go +++ b/pool.go @@ -104,16 +104,16 @@ func (p *Pool) periodicallyPurge() { // NewPool generates an instance of ants pool. func NewPool(size int) (*Pool, error) { - return NewTimingPool(size, DEFAULT_CLEAN_INTERVAL_TIME, false) + return NewUltimatePool(size, DEFAULT_CLEAN_INTERVAL_TIME, false) } // NewPoolPreMalloc generates an instance of ants pool with the memory pre-allocation of pool size. func NewPoolPreMalloc(size int) (*Pool, error) { - return NewTimingPool(size, DEFAULT_CLEAN_INTERVAL_TIME, true) + return NewUltimatePool(size, DEFAULT_CLEAN_INTERVAL_TIME, true) } -// NewTimingPool generates an instance of ants pool with a custom timed task. -func NewTimingPool(size, expiry int, preAlloc bool) (*Pool, error) { +// NewUltimatePool generates an instance of ants pool with a custom timed task. +func NewUltimatePool(size, expiry int, preAlloc bool) (*Pool, error) { if size <= 0 { return nil, ErrInvalidPoolSize } diff --git a/pool_func.go b/pool_func.go index d5ae85b..5085e78 100644 --- a/pool_func.go +++ b/pool_func.go @@ -107,16 +107,16 @@ func (p *PoolWithFunc) periodicallyPurge() { // NewPoolWithFunc generates an instance of ants pool with a specific function. func NewPoolWithFunc(size int, pf func(interface{})) (*PoolWithFunc, error) { - return NewTimingPoolWithFunc(size, DEFAULT_CLEAN_INTERVAL_TIME, pf, false) + return NewUltimatePoolWithFunc(size, DEFAULT_CLEAN_INTERVAL_TIME, pf, false) } // NewPoolWithFuncPreMalloc generates an instance of ants pool with a specific function and the memory pre-allocation of pool size. func NewPoolWithFuncPreMalloc(size int, pf func(interface{})) (*PoolWithFunc, error) { - return NewTimingPoolWithFunc(size, DEFAULT_CLEAN_INTERVAL_TIME, pf, true) + return NewUltimatePoolWithFunc(size, DEFAULT_CLEAN_INTERVAL_TIME, pf, true) } -// NewTimingPoolWithFunc generates an instance of ants pool with a specific function and a custom timed task. -func NewTimingPoolWithFunc(size, expiry int, pf func(interface{}), preAlloc bool) (*PoolWithFunc, error) { +// NewUltimatePoolWithFunc generates an instance of ants pool with a specific function and a custom timed task. +func NewUltimatePoolWithFunc(size, expiry int, pf func(interface{}), preAlloc bool) (*PoolWithFunc, error) { if size <= 0 { return nil, ErrInvalidPoolSize }