Documentation ¶
Overview ¶
Package flock provides a simple file locking mechanism for linux/unix based on unix.Flock.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrWouldBlock = errors.New("would block")
ErrWouldBlock is returned by the non-blocking locks when it would have blocked.
Functions ¶
This section is empty.
Types ¶
type Flock ¶
type Flock struct {
// contains filtered or unexported fields
}
Flock is a file based lock mechanism.
func (*Flock) Close ¶
Close closes the open file. This should be called when the lock is no longer needed.
func (*Flock) LockExclusive ¶
LockExclusive attempts to get an exclusive lock but won't block if it can't be immediately acquired. In this case, the return error is ErrWouldBlock.
func (*Flock) LockExclusiveWait ¶
LockExclusiveWait attempts to get an exclusive lock and waits until that lock is acquired or an error occurs.
func (*Flock) LockShared ¶
LockShared attempts to get a shared lock but won't block if it can't be immediately acquired. In this case, the return error is ErrWouldBlock.
func (*Flock) LockSharedWait ¶
LockSharedWait attempts to get a shared lock and waits until that lock is acquired or an error occurs.