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