better comment for mpb.WithWaitGroup
Vladimir Bauer
5 years ago
| 65 | 65 |
|
| 66 | 66 |
```go
|
| 67 | 67 |
var wg sync.WaitGroup
|
| 68 | |
// pass &wg (optional), so p will wait for it eventually
|
|
68 |
// passed &wg will be accounted at p.Wait() call
|
| 69 | 69 |
p := mpb.New(mpb.WithWaitGroup(&wg))
|
| 70 | 70 |
total, numBars := 100, 3
|
| 71 | 71 |
wg.Add(numBars)
|
| 11 | 11 |
|
| 12 | 12 |
func main() {
|
| 13 | 13 |
var wg sync.WaitGroup
|
| 14 | |
// pass &wg (optional), so p will wait for it eventually
|
|
14 |
// passed &wg will be accounted at p.Wait() call
|
| 15 | 15 |
p := mpb.New(mpb.WithWaitGroup(&wg))
|
| 16 | 16 |
total, numBars := 100, 3
|
| 17 | 17 |
wg.Add(numBars)
|