MCPcopy
hub / github.com/netdata/netdata / Lock

Method Lock

src/go/plugin/framework/filelock/filelock.go:25–42  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

23}
24
25func (l *Locker) Lock(name string) (bool, error) {
26 filename := l.filename(name)
27
28 if _, ok := l.locks[filename]; ok {
29 return true, nil
30 }
31
32 locker := flock.New(filename)
33
34 ok, err := locker.TryLock()
35 if ok {
36 l.locks[filename] = locker
37 } else {
38 _ = locker.Close()
39 }
40
41 return ok, err
42}
43
44func (l *Locker) Unlock(name string) {
45 filename := l.filename(name)

Callers 15

securetransport.pyFile · 0.80
__init__Method · 0.80
monotonic.pyFile · 0.80
WriteMethod · 0.80
LenMethod · 0.80
StringMethod · 0.80
EnableDataCaptureMethod · 0.80
RegisterJobMethod · 0.80
RecordJobStructureMethod · 0.80
UpdateJobStructureMethod · 0.80
RecordCollectionMethod · 0.80
recordWriteErrorMethod · 0.80

Calls 3

filenameMethod · 0.95
NewMethod · 0.65
CloseMethod · 0.65

Tested by 15

WriteMethod · 0.64
LenMethod · 0.64
StringMethod · 0.64
WriteMethod · 0.64
StringMethod · 0.64
TestManager_tryFinalizeFunction · 0.64
RegisterComponentMethod · 0.64
UnregisterComponentMethod · 0.64
snapshotMethod · 0.64