forked from mirror/ants
correct some mistakes in English grammar
This commit is contained in:
parent
974dc229df
commit
9b3fe4b603
|
@ -82,7 +82,7 @@ func main() {
|
|||
fmt.Printf("finish all tasks.\n")
|
||||
|
||||
// Uses the pool with a function,
|
||||
// sets 10 the size of goroutine pool and 1 second for expired duration
|
||||
// sets 10 to the size of goroutine pool and 1 second for expired duration
|
||||
p, _ := ants.NewPoolWithFunc(10, func(i interface{}) {
|
||||
myFunc(i)
|
||||
wg.Done()
|
||||
|
@ -215,7 +215,7 @@ In that benchmark-picture, the first and second benchmarks performed test with 1
|
|||
|
||||
![](ants_bench_poolwithfunc.png)
|
||||
|
||||
### Throughput (situation for only submitting tasks and need not waiting for all the tasks to be completed)
|
||||
### Throughput (it is suitable for scenarios where asynchronous tasks are submitted without concern for results)
|
||||
|
||||
#### 100K tasks
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ func main() {
|
|||
fmt.Printf("finish all tasks.\n")
|
||||
|
||||
// Uses the pool with a function,
|
||||
// Sets 10 the size of goroutine pool and 1 second for expired duration
|
||||
// sets 10 to the size of goroutine pool and 1 second for expired duration
|
||||
p, _ := ants.NewPoolWithFunc(10, func(i interface{}) {
|
||||
myFunc(i)
|
||||
wg.Done()
|
||||
|
|
|
@ -49,7 +49,7 @@ func main() {
|
|||
|
||||
runTimes := 1000
|
||||
|
||||
// use the common pool
|
||||
// Uses the common pool
|
||||
var wg sync.WaitGroup
|
||||
for i := 0; i < runTimes; i++ {
|
||||
wg.Add(1)
|
||||
|
@ -62,14 +62,14 @@ func main() {
|
|||
fmt.Printf("running goroutines: %d\n", ants.Running())
|
||||
fmt.Printf("finish all tasks.\n")
|
||||
|
||||
// use the pool with a function
|
||||
// set 10 the size of goroutine pool and 1 second for expired duration
|
||||
// Uses the pool with a function,
|
||||
// sets 10 to the size of goroutine pool and 1 second for expired duration
|
||||
p, _ := ants.NewPoolWithFunc(10, func(i interface{}) {
|
||||
myFunc(i)
|
||||
wg.Done()
|
||||
})
|
||||
defer p.Release()
|
||||
// submit tasks
|
||||
// Submits tasks
|
||||
for i := 0; i < runTimes; i++ {
|
||||
wg.Add(1)
|
||||
p.Serve(int32(i))
|
||||
|
|
Loading…
Reference in New Issue