Lock acquires the gate unconditionally. It reports whether the condition is set.
()
| 32 | // Lock acquires the gate unconditionally. |
| 33 | // It reports whether the condition is set. |
| 34 | func (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. |
no outgoing calls