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

Method TryAcquire

interpreter/async.go:476–489  ·  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

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

Callers 1

launchMethod · 0.80

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected