Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAlreadyLocked = errors.New("another snappy is running, try again later")
ErrAlreadyLocked is returned when an attempts is made to lock an already-locked FileLock.
Functions ¶
Types ¶
type LockedFile ¶
type LockedFile int
LockedFile is a handle you can use to Unlock a file lock.
func Lock ¶
func Lock(path string, wait bool) (LockedFile, error)
Lock opens (and possibly creates) a new file at the given path and applies an exclusive advisory lock on it.
If the file already has an advisory lock, the `wait` flag determins whether to wait until it is removed or return ErrAlreadyLocked.
func (*LockedFile) Unlock ¶
func (fd *LockedFile) Unlock() error
Unlock closes the file, thus also removing the advisary lock on it.
Click to show internal directories.
Click to hide internal directories.