Documentation
¶
Overview ¶
Package lock implements advisory shared and exclusive filesystem locks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrContended = errors.New("lock is held") ErrReleased = errors.New("lock is already released") )
Functions ¶
func OwnerMatches ¶
OwnerMatches verifies both PID existence and process-start evidence, avoiding false ownership after PID reuse. A false result with a non-nil error is indeterminate and must not be treated as proof that a lock is stale.
Types ¶
type ContentionError ¶
func (*ContentionError) Error ¶
func (e *ContentionError) Error() string
func (*ContentionError) Unwrap ¶
func (e *ContentionError) Unwrap() error
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
func Acquire ¶
Acquire waits until the lock is acquired or ctx is cancelled. Exclusive acquisitions replace metadata while holding the kernel lock.
func (*Lock) DuplicateFile ¶
DuplicateFile returns a descriptor for the same open file description. When passed through exec.Cmd.ExtraFiles, it keeps the advisory lock alive if the wrapper process exits before its child.
Click to show internal directories.
Click to hide internal directories.