forked from mirror/ants
🐶 Align some code comments
This commit is contained in:
parent
e099ad7d4c
commit
4c0f9a4d6f
|
@ -49,7 +49,7 @@ func main() {
|
|||
|
||||
runTimes := 1000
|
||||
|
||||
// Use the common pool
|
||||
// Use the common pool.
|
||||
var wg sync.WaitGroup
|
||||
for i := 0; i < runTimes; i++ {
|
||||
wg.Add(1)
|
||||
|
@ -63,13 +63,13 @@ func main() {
|
|||
fmt.Printf("finish all tasks.\n")
|
||||
|
||||
// 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{}) {
|
||||
myFunc(i)
|
||||
wg.Done()
|
||||
})
|
||||
defer p.Release()
|
||||
// Submit tasks one by one
|
||||
// Submit tasks one by one.
|
||||
for i := 0; i < runTimes; i++ {
|
||||
wg.Add(1)
|
||||
p.Serve(int32(i))
|
||||
|
|
Loading…
Reference in New Issue