MCPcopy
hub / github.com/grpc/grpc-go / release

Method release

server.go:2246–2255  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2244}
2245
2246func (q *atomicSemaphore) release() {
2247 // N.B. the "<= 0" check below should allow for this to work with multiple
2248 // concurrent calls to acquire, but also note that with synchronous calls to
2249 // acquire, as our system does, n will never be less than -1. There are
2250 // fairness issues (queuing) to consider if this was to be generalized.
2251 if q.n.Add(1) <= 0 {
2252 // An acquire was waiting on us. Unblock it.
2253 q.wait <- struct{}{}
2254 }
2255}
2256
2257func newHandlerQuota(n uint32) *atomicSemaphore {
2258 a := &atomicSemaphore{wait: make(chan struct{}, 1)}

Callers 1

serveStreamsMethod · 0.80

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected