Documentation ¶
Overview ¶
Package locking provides simple Flock based file locking utilities designed for synchronization around files on a single system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exclusive ¶
Exclusive attempts to obtain an exclusive lock on the open file descriptor. This will block until the lock can be obtained.
func IsResourceUnavailable ¶
IsResourceUnavailable is used on the errors returned by TryExclusive and TryShare to determine if the error means the lock could not be obtained. The above functions may return other errors, of course.
func Release ¶
Release will release the currently held exclusive or shared lock on the given open file descriptor. Note that closing the file descriptor also releases locks currently held on it.
func Share ¶
Share attempts to obtain a shared or read-only lock on the given open file descriptor. Multiple processes or file descriptors may hold shared locks on the same file. This will block until the lock can be obtained.
func TryExclusive ¶
TryExclusive is the non-blocking form of Exclusive and will return an error if the lock could not be obtained immediately.
Types ¶
This section is empty.