From b1e4d22aeac55d3112ebb0c45316e62ef2645765 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Fri, 6 Jul 2018 20:51:16 +0800 Subject: [PATCH] optimization for codes --- README.md | 4 ++-- README_ZH.md | 2 +- pool_func.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ab6a6ce..4e6156f 100644 --- a/README.md +++ b/README.md @@ -111,8 +111,8 @@ ants.Submit(func() {}) Ants also supports custom limited pool. You can use the `NewPool` method to create a pool with the given capacity, as following: ``` go -// set 10000 the size of goroutine pool -p, _ := ants.NewPool(10000) +// set 10000 the size of goroutine pool and 1 second for expired duration +p, _ := ants.NewPool(10000, 1) // submit a task p.Submit(func() {}) ``` diff --git a/README_ZH.md b/README_ZH.md index 8a61528..b238673 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -112,7 +112,7 @@ ants.Submit(func() {}) `ants`支持实例化使用者自己的一个 Pool ,指定具体的池容量;通过调用 `NewPool` 方法可以实例化一个新的带有指定容量的 Pool ,如下: ``` go -// set 10000 the size of goroutine pool +// set 10000 the size of goroutine pool and 1 second for expired duration p, _ := ants.NewPool(10000) // submit a task p.Submit(func() {}) diff --git a/pool_func.go b/pool_func.go index cfcbba5..7c6caf5 100644 --- a/pool_func.go +++ b/pool_func.go @@ -100,7 +100,7 @@ func NewPoolWithFunc(size, expiry int, f pf) (*PoolWithFunc, error) { expiryDuration: time.Duration(expiry) * time.Second, poolFunc: f, } - p.MonitorAndClear() + p.monitorAndClear() return p, nil }