()
| 2237 | } |
| 2238 | |
| 2239 | func (q *atomicSemaphore) acquire() { |
| 2240 | if q.n.Add(-1) < 0 { |
| 2241 | // We ran out of quota. Block until a release happens. |
| 2242 | <-q.wait |
| 2243 | } |
| 2244 | } |
| 2245 | |
| 2246 | func (q *atomicSemaphore) release() { |
| 2247 | // N.B. the "<= 0" check below should allow for this to work with multiple |