Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsLockingError ¶
IsLockingError checks whether an error object is os-specific error which represents failure to acquire lock specified
func Lock ¶
Lock places an advisory write lock on the file, blocking until it can be locked or timing out.
If Lock returns nil, no other process will be able to place a read or write lock on the file until this process exits, closes f, or calls Unlock on it.
If f's descriptor is already read- or write-locked, the behavior of Lock is unspecified.
Closing the file may or may not release the lock promptly. Callers should ensure that Unlock is always called when Lock succeeds.
func RLock ¶
RLock places an advisory read lock on the file, blocking until it can be locked or timing out.
If RLock returns nil, no other process will be able to place a write lock on the file until this process exits, closes f, or calls Unlock on it.
If f is already read- or write-locked, the behavior of RLock is unspecified.
Closing the file may or may not release the lock promptly. Callers should ensure that Unlock is always called if RLock succeeds.
func TryLock ¶
TryLock places an advisory write lock on the file, but returns immediately when it can not be locked.
If Lock returns nil, no other process will be able to place a read or write lock on the file until this process exits, closes f, or calls Unlock on it.
If f's descriptor is already read- or write-locked, the behavior of Lock is unspecified.
Closing the file may or may not release the lock promptly. Callers should ensure that Unlock is always called when Lock succeeds.
func TryRLock ¶
TryRLock places an advisory read lock on the file, but returns immediately when it can not be locked.
If RLock returns nil, no other process will be able to place a write lock on the file until this process exits, closes f, or calls Unlock on it.
If f is already read- or write-locked, the behavior of RLock is unspecified.
Closing the file may or may not release the lock promptly. Callers should ensure that Unlock is always called if RLock succeeds.
Types ¶
type File ¶
type File interface { // Fd returns a valid file descriptor. // (If the File is an *os.File, it must not be closed.) Fd() uintptr }
A File provides the minimal set of methods required to lock an open file. File implementations must be usable as map keys. The usual implementation is *os.File.