Documentation
¶
Overview ¶
Package fslock provides a cross-process mutex based on file locks.
It is built on top of flock for linux and darwin, and LockFileEx on Windows.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrLocked error = trylockError("fslock is already locked")
ErrLocked indicates TryLock failed because the lock was already locked.
var ErrTimeout error = timeoutError("lock timeout exceeded")
ErrTimeout indicates that the lock attempt timed out.
Functions ¶
This section is empty.
Types ¶
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
Lock implements cross-process locks using syscalls. This implementation is based on flock syscall.
func (*Lock) LockWithContext ¶ added in v0.0.4
LockWithContext tries to lock the lock until the context is canceled or its deadline is exceeded. If the context is canceled before the lock is acquired, this method returns ctx.Err().
func (*Lock) LockWithTimeout ¶
LockWithTimeout tries to lock the lock until the timeout expires. If the timeout expires, this method will return ErrTimeout.
