mirror of https://github.com/panjf2000/ants.git
🐶 Align some code comments
This commit is contained in:
parent
e099ad7d4c
commit
4c0f9a4d6f
|
@ -49,7 +49,7 @@ func main() {
|
||||||
|
|
||||||
runTimes := 1000
|
runTimes := 1000
|
||||||
|
|
||||||
// Use the common pool
|
// Use the common pool.
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
for i := 0; i < runTimes; i++ {
|
for i := 0; i < runTimes; i++ {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
@ -63,13 +63,13 @@ func main() {
|
||||||
fmt.Printf("finish all tasks.\n")
|
fmt.Printf("finish all tasks.\n")
|
||||||
|
|
||||||
// Use the pool with a function,
|
// Use the pool with a function,
|
||||||
// set 10 to the size of goroutine pool and 1 second for expired duration
|
// set 10 to the size of goroutine pool and 1 second for expired duration.
|
||||||
p, _ := ants.NewPoolWithFunc(10, func(i interface{}) {
|
p, _ := ants.NewPoolWithFunc(10, func(i interface{}) {
|
||||||
myFunc(i)
|
myFunc(i)
|
||||||
wg.Done()
|
wg.Done()
|
||||||
})
|
})
|
||||||
defer p.Release()
|
defer p.Release()
|
||||||
// Submit tasks one by one
|
// Submit tasks one by one.
|
||||||
for i := 0; i < runTimes; i++ {
|
for i := 0; i < runTimes; i++ {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
p.Serve(int32(i))
|
p.Serve(int32(i))
|
||||||
|
|
Loading…
Reference in New Issue