Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrLocked = errors.New("locked") ErrTimeout = errors.New("lock timed out") )
Functions ¶
func Acquire ¶
Acquire a lock on the given path, storing the current PID and a message in the lock file.
The lock is released when the returned function is called.
If the lock is held by the current process, Acquire will return a no-op release function and the message WILL NOT be updated.
If the lock is held by another process, Acquire will block until the lock is released or the context is cancelled.
The file is NOT deleted on release; doing so creates a race condition that allows multiple processes to acquire the same lock.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.