Improve README.md
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/alitto/pond"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
// Create a pool with 100 workers
|
||||
pool := pond.New(100, 1000)
|
||||
|
||||
// Submit 1000 tasks
|
||||
for i := 0; i < 1000; i++ {
|
||||
n := i
|
||||
pool.Submit(func() {
|
||||
fmt.Printf("Running task #%d\n", n)
|
||||
})
|
||||
}
|
||||
|
||||
// Stop the pool and wait for all submitted tasks to complete
|
||||
pool.StopAndWait()
|
||||
}
|
||||
Reference in New Issue
Block a user