Get returns a lock that is bound to a specific id.
(id string)
| 17 | |
| 18 | // Get returns a lock that is bound to a specific id. |
| 19 | func (i *IdLock) Get(id string) sync.Locker { |
| 20 | i.locksMu.Lock() |
| 21 | defer i.locksMu.Unlock() |
| 22 | |
| 23 | var l sync.Locker |
| 24 | var ok bool |
| 25 | |
| 26 | l, ok = i.locks[id] |
| 27 | if !ok { |
| 28 | l = &sync.Mutex{} |
| 29 | i.locks[id] = l |
| 30 | } |
| 31 | |
| 32 | return l |
| 33 | } |
nothing calls this directly
no outgoing calls
no test coverage detected