mirror of
https://github.com/panjf2000/ants.git
synced 2025-12-18 03:01:01 +00:00
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…
x
Reference in New Issue
Block a user