From 67766a56615dd4369d6b4f0738b228c806290e91 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Fri, 17 Jan 2020 12:44:00 +0800 Subject: [PATCH] Document Reboot() --- README.md | 8 ++++++++ README_ZH.md | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 05499b3..540016d 100644 --- a/README.md +++ b/README.md @@ -291,7 +291,15 @@ p, _ := ants.NewPool(100000, ants.WithPreAlloc(true)) pool.Release() ``` +### Reboot Pool + +```go +// A pool that has been released can be still used once you invoke the Reboot(). +pool.Reboot() +``` + ## ⚙️ About sequence + All 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 would be executed concurrently. ## 🧲 Benchmarks diff --git a/README_ZH.md b/README_ZH.md index 1dd516f..3d85f49 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -292,7 +292,14 @@ p, _ := ants.NewPool(100000, ants.WithPreAlloc(true)) pool.Release() ``` -### 关于任务执行顺序 +### Reboot Pool + +```go +// 只要调用 Reboot() 方法,就可以重新激活一个之前已经被销毁掉的池,并且投入使用。 +pool.Reboot() +``` + +## ⚙️ 关于任务执行顺序 `ants` 并不保证提交的任务被执行的顺序,执行的顺序也不是和提交的顺序保持一致,因为在 `ants` 是并发地处理所有提交的任务,提交的任务会被分派到正在并发运行的 workers 上去,因此那些任务将会被并发且无序地被执行。