(maxConcurrency int, completions chan<- int64)
| 467 | } |
| 468 | |
| 469 | func newAsyncGate(maxConcurrency int, completions chan<- int64) *asyncGate { |
| 470 | var sem chan struct{} |
| 471 | if maxConcurrency > 0 { |
| 472 | sem = make(chan struct{}, maxConcurrency) |
| 473 | } |
| 474 | return &asyncGate{ |
| 475 | semaphore: sem, |
| 476 | completions: completions, |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | // TryAcquire attempts to acquire a concurrency slot and increments the active calls count. |
| 481 | func (g *asyncGate) TryAcquire() bool { |
no outgoing calls