Documentation ¶
Overview ¶
Example (FileLockNewAndUnlock) ¶
lockHandle, err := filelock.New("myLockFile.lock") if err != nil && err == filelock.ErrFileIsBeingUsed { return } if err != nil { fmt.Println(err) return } // do main program fmt.Println("running") err = lockHandle.Unlock() if err != nil { fmt.Println(err) }
Output: running
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrFileIsBeingUsed is returned when file is in use by another program ErrFileIsBeingUsed = errors.New("file is being used by another process") // ErrFileAlreadyUnlocked is returned when file has already been unlocked or was not locked ErrFileAlreadyUnlocked = errors.New("file already unlocked") )
Functions ¶
This section is empty.
Types ¶
type LockHandle ¶
type LockHandle struct {
// contains filtered or unexported fields
}
LockHandle to be used for locking and unlocking the file
func (*LockHandle) Unlock ¶
func (lockHandle *LockHandle) Unlock() error
Unlock unlocks the file lock
Click to show internal directories.
Click to hide internal directories.