MCPcopy Index your code
hub / github.com/kopia/kopia / getMutexAndAddRef

Method getMutexAndAddRef

internal/cache/mutex_map.go:57–77  ·  view source on GitHub ↗
(key string)

Source from the content-addressed store, hash-verified

55}
56
57func (m *mutexMap) getMutexAndAddRef(key string) *sync.RWMutex {
58 m.mu.Lock()
59 defer m.mu.Unlock()
60
61 ent := m.entries[key]
62 if ent == nil {
63 if m.entries == nil {
64 m.entries = make(map[string]*mutexMapEntry)
65 }
66
67 ent = &mutexMapEntry{
68 mut: &sync.RWMutex{},
69 }
70
71 m.entries[key] = ent
72 }
73
74 ent.refCount++
75
76 return ent.mut
77}
78
79func (m *mutexMap) getMutexAndReleaseRef(key string) *sync.RWMutex {
80 m.mu.Lock()

Callers 4

exclusiveLockMethod · 0.95
tryExclusiveLockMethod · 0.95
sharedLockMethod · 0.95
trySharedLockMethod · 0.95

Calls 2

LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected