Skip to content

Commit

Permalink
Document Reboot()
Browse files Browse the repository at this point in the history
  • Loading branch information
panjf2000 committed Jan 17, 2020
1 parent d32d668 commit 67766a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,14 @@ p, _ := ants.NewPool(100000, ants.WithPreAlloc(true))
pool.Release()
```

### 关于任务执行顺序
### Reboot Pool

```go
// 只要调用 Reboot() 方法,就可以重新激活一个之前已经被销毁掉的池,并且投入使用。
pool.Reboot()
```

## ⚙️ 关于任务执行顺序

`ants` 并不保证提交的任务被执行的顺序,执行的顺序也不是和提交的顺序保持一致,因为在 `ants` 是并发地处理所有提交的任务,提交的任务会被分派到正在并发运行的 workers 上去,因此那些任务将会被并发且无序地被执行。

Expand Down

0 comments on commit 67766a5

Please sign in to comment.