Documentation
¶
Overview ¶
Package fslock provides advisory file locking for coordinating exclusive access to shared resources across processes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock represents an acquired advisory file lock.
func Acquire ¶
Acquire acquires an exclusive advisory lock on the file at path, retrying until timeout elapses. Returns an error if the lock cannot be acquired.
func (Lock) Release ¶
Release unlinks the lock file and releases the lock. Unlinking before closing ensures no new caller can open the same inode and take the lock while we still hold it; combined with the inode recheck in Acquire, this guarantees that a fresh file at the same path is never raced against a soon-to-be-deleted one.
Click to show internal directories.
Click to hide internal directories.