MCPcopy
hub / github.com/kopia/kopia / trySharedLock

Method trySharedLock

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

Source from the content-addressed store, hash-verified

42}
43
44func (m *mutexMap) trySharedLock(key string) bool {
45 if !m.getMutexAndAddRef(key).TryRLock() { // +checklocksignore
46 m.getMutexAndReleaseRef(key)
47 return false
48 }
49
50 return true
51}
52
53func (m *mutexMap) sharedUnlock(key string) {
54 m.getMutexAndReleaseRef(key).RUnlock() // +checklocksignore

Callers 2

TestMutexMap_SharedLockFunction · 0.95

Calls 2

getMutexAndAddRefMethod · 0.95
getMutexAndReleaseRefMethod · 0.95

Tested by 2

TestMutexMap_SharedLockFunction · 0.76