forked from mirror/ants
update example code
This commit is contained in:
parent
fdf34beb43
commit
109dc9b03a
|
@ -47,6 +47,8 @@ func demoFunc() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
defer ants.Release()
|
||||||
|
|
||||||
runTimes := 1000
|
runTimes := 1000
|
||||||
|
|
||||||
// use the common pool
|
// use the common pool
|
||||||
|
@ -70,6 +72,7 @@ func main() {
|
||||||
wg.Done()
|
wg.Done()
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
defer p.Release()
|
||||||
// submit tasks
|
// submit tasks
|
||||||
for i := 0; i < runTimes; i++ {
|
for i := 0; i < runTimes; i++ {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
Loading…
Reference in New Issue