Documentation ¶
Overview ¶
FileLock object can be used to create locks that can be used to synchronise different processes running on the same machine.
The current implementation of FileLock will always release all acquired locks once the process itself exits.
In order to reduce syscall overhead/complexity, this does not implement a fair lock. In particular, flock is reader-preferred and may starve writers. If you require fairness, you can implement it on top of this interface using multiple FileLocks.
NOTE: FileLock is not thread safe, since it is not meant to be used from multiple threads but from different processes instead!
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsHeldElsewhere ¶
Returns whether the error returned by TryLock/TryRLock is the result of the lock already being held by another process.
Types ¶
type FileLock ¶
type FileLock struct {
// contains filtered or unexported fields
}
func (*FileLock) RUnlock ¶
Unlocks the shared lock. If the Lock was never acquired before or if the Lock was acquired but was not shared, it will return an error.