New creates a BoundedWaitGroup with the given concurrency.
(capacity uint)
| 10 | |
| 11 | // New creates a BoundedWaitGroup with the given concurrency. |
| 12 | func New(capacity uint) BoundedWaitGroup { |
| 13 | if capacity == 0 { |
| 14 | panic("BoundedWaitGroup capacity must be greater than zero or else it will block forever.") |
| 15 | } |
| 16 | return BoundedWaitGroup{ch: make(chan struct{}, capacity)} |
| 17 | } |
| 18 | |
| 19 | // Add the number of items to the group. Blocks until there is capacity. |
| 20 | func (bwg *BoundedWaitGroup) Add(delta int) { |
no outgoing calls