From a0d7a0e68fe37ccf5113bfb1808735faa40fb384 Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Sat, 1 Dec 2018 19:26:58 +0800 Subject: [PATCH] correct the example code --- examples/main.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/main.go b/examples/main.go index feef5c4..521172c 100644 --- a/examples/main.go +++ b/examples/main.go @@ -55,10 +55,9 @@ func main() { var wg sync.WaitGroup for i := 0; i < runTimes; i++ { wg.Add(1) - ants.Submit(func() error { + ants.Submit(func() { demoFunc() wg.Done() - return nil }) } wg.Wait() @@ -67,10 +66,9 @@ func main() { // use the pool with a function // set 10 the size of goroutine pool and 1 second for expired duration - p, _ := ants.NewPoolWithFunc(10, func(i interface{}) error { + p, _ := ants.NewPoolWithFunc(10, func(i interface{}) { myFunc(i) wg.Done() - return nil }) defer p.Release() // submit tasks