MCPcopy
hub / github.com/golang/net / Lock

Method Lock

internal/gate/gate.go:34–41  ·  view source on GitHub ↗

Lock acquires the gate unconditionally. It reports whether the condition is set.

()

Source from the content-addressed store, hash-verified

32// Lock acquires the gate unconditionally.
33// It reports whether the condition is set.
34func (g *Gate) Lock() (set bool) {
35 select {
36 case <-g.set:
37 return true
38 case <-g.unset:
39 return false
40 }
41}
42
43// WaitAndLock waits until the condition is set before acquiring the gate.
44// If the context expires, WaitAndLock returns an error and does not acquire the gate.

Callers 15

setControlMessageFunction · 0.80
WriteMethod · 0.80
wantEventsMethod · 0.80
appendStreamFramesMethod · 0.80
appendStreamFramesPTOMethod · 0.80
ReadMethod · 0.80
ReadByteMethod · 0.80
WriteMethod · 0.80
WriteByteMethod · 0.80
flushFastOutputBufferMethod · 0.80
resetInternalMethod · 0.80

Calls

no outgoing calls

Tested by 15

WriteMethod · 0.64
wantEventsMethod · 0.64
readMethod · 0.64
WriteMethod · 0.64
TestMemLSExpiryFunction · 0.64
consistentMethod · 0.64
newPacketConnMethod · 0.64
connForAddrMethod · 0.64
WriteToMethod · 0.64
CloseMethod · 0.64
TestGateLockAndUnlockFunction · 0.64
TestGateWaitAndLockFunction · 0.64