MCPcopy Create free account
hub / github.com/diillson/chatcli / getLock

Method getLock

cli/agent/workers/file_lock.go:23–38  ·  view source on GitHub ↗

getLock returns or creates the mutex for a normalized file path.

(path string)

Source from the content-addressed store, hash-verified

21
22// getLock returns or creates the mutex for a normalized file path.
23func (m *FileLockManager) getLock(path string) *sync.Mutex {
24 abs, err := filepath.Abs(path)
25 if err != nil {
26 abs = path
27 }
28
29 m.mu.Lock()
30 defer m.mu.Unlock()
31
32 lock, ok := m.locks[abs]
33 if !ok {
34 lock = &sync.Mutex{}
35 m.locks[abs] = lock
36 }
37 return lock
38}
39
40// Lock acquires the mutex for a given file path.
41func (m *FileLockManager) Lock(path string) {

Callers 3

LockMethod · 0.95
UnlockMethod · 0.95
WithLockMethod · 0.95

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected