Files
pond/examples/basic.go
T
adurantecredify de7514db30 Improve README.md
2020-03-28 18:25:36 -03:00

25 lines
356 B
Go

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()
}