MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / tryLock

Method tryLock

internal/utils/fs/locker.go:64–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62}
63
64func (this *Locker) tryLock() (ok bool, err error) {
65 err = syscall.Flock(int(this.fp.Fd()), syscall.LOCK_EX|syscall.LOCK_NB)
66 if err == nil {
67 return true, nil
68 }
69
70 errno, isErrNo := err.(syscall.Errno)
71 if !isErrNo {
72 return
73 }
74
75 if !errno.Temporary() {
76 return
77 }
78
79 err = nil // 不提示错误
80
81 return
82}

Callers 2

TryLockMethod · 0.95
LockMethod · 0.95

Calls 1

FdMethod · 0.80

Tested by

no test coverage detected