update example code

This commit is contained in:
andy pan 2018-07-02 14:16:39 +08:00
parent fdf34beb43
commit 109dc9b03a
1 changed files with 3 additions and 0 deletions

View File

@ -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)