Functions
func Hold(path string, mode os.FileMode, wait time.Duration) (*os.File, error)
Hold opens path, creating it with mode, and takes its exclusive lock,
retrying for up to wait so that a probe holding the shared lock for an
instant does not read as a holder. The lease lasts until the returned file
is closed or the process ends. The file itself is never removed: a process
that opened it before a removal could otherwise lock a file no one else
sees.
func Probe(path string, whileFree func() error) (bool, error)
Probe reports whether another process holds the lease at path. A missing
file is a lease no one holds. When no one holds it, whileFree, if set,
runs while Probe holds the shared lock, so no holder can start meanwhile;
its error is returned. Any other failure is returned rather than read as
free.
func TryLock(file *os.File) error
TryLock takes the exclusive lock on file without waiting. It returns ErrHeld
while another process holds it, and any other failure as it is.