Document Reboot()

This commit is contained in:
Andy Pan 2020-01-17 12:44:00 +08:00
parent d32d668565
commit 67766a5661
2 changed files with 16 additions and 1 deletions

View File

@ -291,7 +291,15 @@ p, _ := ants.NewPool(100000, ants.WithPreAlloc(true))
pool.Release() pool.Release()
``` ```
### Reboot Pool
```go
// A pool that has been released can be still used once you invoke the Reboot().
pool.Reboot()
```
## ⚙️ About sequence ## ⚙️ 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. 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 ## 🧲 Benchmarks

View File

@ -292,7 +292,14 @@ p, _ := ants.NewPool(100000, ants.WithPreAlloc(true))
pool.Release() pool.Release()
``` ```
### 关于任务执行顺序 ### Reboot Pool
```go
// 只要调用 Reboot() 方法,就可以重新激活一个之前已经被销毁掉的池,并且投入使用。
pool.Reboot()
```
## ⚙️ 关于任务执行顺序
`ants` 并不保证提交的任务被执行的顺序,执行的顺序也不是和提交的顺序保持一致,因为在 `ants` 是并发地处理所有提交的任务,提交的任务会被分派到正在并发运行的 workers 上去,因此那些任务将会被并发且无序地被执行。 `ants` 并不保证提交的任务被执行的顺序,执行的顺序也不是和提交的顺序保持一致,因为在 `ants` 是并发地处理所有提交的任务,提交的任务会被分派到正在并发运行的 workers 上去,因此那些任务将会被并发且无序地被执行。