https://github.com/bep/workers
Set up tasks to be executed in parallel.
https://github.com/bep/workers
Last synced: about 1 year ago
JSON representation
Set up tasks to be executed in parallel.
- Host: GitHub
- URL: https://github.com/bep/workers
- Owner: bep
- License: mit
- Created: 2021-07-07T10:37:11.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-08-07T07:51:44.000Z (almost 4 years ago)
- Last Synced: 2025-02-28T13:49:10.550Z (about 1 year ago)
- Language: Go
- Size: 7.81 KB
- Stars: 11
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/bep/workers/actions?query=workflow%3ATest)
[](https://goreportcard.com/report/github.com/bep/workers)
[](https://godoc.org/github.com/bep/workers)
A simple Go library to set up tasks to be executed in parallel.
```go
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)
}
}
```