mirror of https://github.com/panjf2000/ants.git
update readme files
This commit is contained in:
parent
a0d7a0e68f
commit
93b755c5ad
|
@ -74,10 +74,9 @@ func main() {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
for i := 0; i < runTimes; i++ {
|
for i := 0; i < runTimes; i++ {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
ants.Submit(func() error {
|
ants.Submit(func() {
|
||||||
demoFunc()
|
demoFunc()
|
||||||
wg.Done()
|
wg.Done()
|
||||||
return nil
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
@ -86,10 +85,9 @@ func main() {
|
||||||
|
|
||||||
// use the pool with a function
|
// use the pool with a function
|
||||||
// set 10 the size of goroutine pool and 1 second for expired duration
|
// 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)
|
myFunc(i)
|
||||||
wg.Done()
|
wg.Done()
|
||||||
return nil
|
|
||||||
})
|
})
|
||||||
defer p.Release()
|
defer p.Release()
|
||||||
// submit tasks
|
// submit tasks
|
||||||
|
|
|
@ -73,10 +73,9 @@ func main() {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
for i := 0; i < runTimes; i++ {
|
for i := 0; i < runTimes; i++ {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
ants.Submit(func() error {
|
ants.Submit(func() {
|
||||||
demoFunc()
|
demoFunc()
|
||||||
wg.Done()
|
wg.Done()
|
||||||
return nil
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
@ -85,10 +84,9 @@ func main() {
|
||||||
|
|
||||||
// use the pool with a function
|
// use the pool with a function
|
||||||
// set 10 the size of goroutine pool and 1 second for expired duration
|
// 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)
|
myFunc(i)
|
||||||
wg.Done()
|
wg.Done()
|
||||||
return nil
|
|
||||||
})
|
})
|
||||||
defer p.Release()
|
defer p.Release()
|
||||||
// submit tasks
|
// submit tasks
|
||||||
|
|
Loading…
Reference in New Issue