From c50c1eac23ed2442e8e7d5745c2745a746caea77 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Sun, 27 Jan 2019 00:05:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Updated=20to=20fit=20the=20refac?= =?UTF-8?q?tor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 +++++++++++--- README_ZH.md | 12 +++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f7a93fe..3c69ad8 100644 --- a/README.md +++ b/README.md @@ -171,15 +171,23 @@ p.Submit(func(){}) ``` ## Tune pool capacity -You can tune the capacity of `ants` pool at any time with `ReSize(int)`: +You can tune the capacity of `ants` pool at any time with `Tune(int)`: ``` go -pool.ReSize(1000) // Tune its capacity to 1000 -pool.ReSize(100000) // Tune its capacity to 100000 +pool.Tune(1000) // Tune its capacity to 1000 +pool.Tune(100000) // Tune its capacity to 100000 ``` Don't worry about the synchronous problems in this case, the function here is thread-safe (or should be called goroutine-safe). +## Release Pool + +```go +pool.Release() +``` + + + ## About sequence All the tasks submitted to `ants` pool will not be guaranteed to be addressed in order, because those tasks scatter among a series of concurrent workers, thus those tasks are executed concurrently. diff --git a/README_ZH.md b/README_ZH.md index 18263a7..28d2d0e 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -171,15 +171,21 @@ p.Submit(func(){}) ``` ## 动态调整协程池容量 -需要动态调整协程池容量可以通过调用`ReSize(int)`: +需要动态调整协程池容量可以通过调用`Tune(int)`: ``` go -pool.ReSize(1000) // Tune its capacity to 1000 -pool.ReSize(100000) // Tune its capacity to 100000 +pool.Tune(1000) // Tune its capacity to 1000 +pool.Tune(100000) // Tune its capacity to 100000 ``` 该方法是线程安全的。 +## 销毁协程池 + +```go +pool.Release() +``` + ## Benchmarks 系统参数: