Set up tasks to be executed in parallel.
MIT License
A simple Go library to set up tasks to be executed in parallel.
package main
import (
"context"
"log"
"github.com/bep/workers"
)
func main() {
// Max 4 tasks to be executed in parallel.
w := workers.New(4)
r, _ := w.Start(context.Background())
r.Run(func() error {
return nil
})
// ... run more tasks.
if err := r.Wait(); err != nil {
log.Fatal(err)
}
}