package gate
Import Path
internal/gate (on go.dev)
Dependency Relation
imports one package, and imported by one package
Involved Source Files
Package gate contains an alternative condition variable.
Package-Level Type Names (only one)
A Gate is a monitor (mutex + condition variable) with one bit of state.
The condition may be either set or unset.
Lock operations may be unconditional, or wait for the condition to be set.
Unlock operations record the new state of the condition.
Lock acquires the gate unconditionally.
It reports whether the condition is set.
LockIfSet acquires the gate if and only if the condition is set.
Unlock sets the condition and releases the gate.
WaitAndLock waits until the condition is set before acquiring the gate.
If the context expires, WaitAndLock returns an error and does not acquire the gate.
func New(set bool) Gate
Package-Level Functions (only one)
New returns a new, unlocked gate.
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |