()
| 144 | } |
| 145 | |
| 146 | func (rt *Runtime) tryAcquire() bool { |
| 147 | for { |
| 148 | used := rt.used.Load() |
| 149 | if used >= int64(rt.cfg.MaxUsesPerRun) { |
| 150 | return false |
| 151 | } |
| 152 | if rt.used.CompareAndSwap(used, used+1) { |
| 153 | return true |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | // release returns a previously acquired use to the pool. Callers must |
| 159 | // invoke this at most once per successful tryAcquire when the advisor |
no test coverage detected