MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TryAcquire

Method TryAcquire

interpreter/async.go:481–494  ·  view source on GitHub ↗

TryAcquire attempts to acquire a concurrency slot and increments the active calls count.

()

Source from the content-addressed store, hash-verified

479
480// TryAcquire attempts to acquire a concurrency slot and increments the active calls count.
481func (g *asyncGate) TryAcquire() bool {
482 if g == nil {
483 return true
484 }
485 if g.semaphore != nil {
486 select {
487 case g.semaphore <- struct{}{}:
488 default:
489 return false
490 }
491 }
492 g.activeCalls.Add(1)
493 return true
494}
495
496// Release releases a concurrency slot and decrements the active calls count (used for defensive recovery).
497func (g *asyncGate) Release() {

Callers 1

launchMethod · 0.80

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected