forked from mirror/ants
🚀 Updated to fit the refactor
This commit is contained in:
parent
90f672b9d5
commit
c50c1eac23
14
README.md
14
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.
|
||||
|
||||
|
|
12
README_ZH.md
12
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
|
||||
|
||||
系统参数:
|
||||
|
|
Loading…
Reference in New Issue