Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chapsuk/wait
Sugared sync.WaitGroup
https://github.com/chapsuk/wait
Last synced: 2 months ago
JSON representation
Sugared sync.WaitGroup
- Host: GitHub
- URL: https://github.com/chapsuk/wait
- Owner: chapsuk
- License: mit
- Created: 2017-09-21T07:31:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T20:52:22.000Z (about 2 years ago)
- Last Synced: 2024-06-19T02:10:28.723Z (7 months ago)
- Language: Go
- Size: 3.91 KB
- Stars: 7
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/chapsuk/wait.svg?branch=master)](https://travis-ci.org/chapsuk/wait)
# What
Sugared `sync.WaitGroup`
## Why
LGTM
## Example
```go
package mainimport (
"context"
"fmt""github.com/chapsuk/wait"
)func do() { fmt.Print("do\n") }
func doWithArgs(i, j int) { fmt.Printf("doWith args: %d %d\n", i, j) }
func doWithContext(ctx context.Context) { fmt.Printf("doWithContext\n") }func main() {
wg := wait.Group{}wg.Add(do)
wg.Add(func() {
doWithArgs(1, 2)
})
wg.AddMany(10, do)
wg.AddWithContext(context.TODO(), doWithContext)
wg.AddManyWithContext(context.TODO(), 10, doWithContext)
wg.Wait()
}```