CheckOut checks out an instance from the pool and releases the lock to let other instances with same identity to grab the lock.
(identity string)
| 53 | // CheckOut checks out an instance from the pool and releases the lock |
| 54 | // to let other instances with same identity to grab the lock. |
| 55 | func (p *ExclusivePool) CheckOut(identity string) { |
| 56 | p.lock.Lock() |
| 57 | defer p.lock.Unlock() |
| 58 | |
| 59 | p.pool[identity].Unlock() |
| 60 | if p.count[identity] == 1 { |
| 61 | delete(p.pool, identity) |
| 62 | delete(p.count, identity) |
| 63 | } else { |
| 64 | p.count[identity]-- |
| 65 | } |
| 66 | } |
no outgoing calls
no test coverage detected