blob: f03c25e997d7f96cfd1c7a2d0be7066281c8fb60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright 2016 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.
// 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.
package fslock
// ErrTimeout indicates that the lock attempt timed out.
var ErrTimeout error = timeoutError("lock timeout exceeded")
type timeoutError string
func (t timeoutError) Error() string {
return string(t)
}
func (timeoutError) Timeout() bool {
return true
}
// ErrLocked indicates TryLock failed because the lock was already locked.
var ErrLocked error = trylockError("fslock is already locked")
type trylockError string
func (t trylockError) Error() string {
return string(t)
}
func (trylockError) Temporary() bool {
return true
}
|