summaryrefslogtreecommitdiff
path: root/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go')
-rw-r--r--vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go27
1 files changed, 18 insertions, 9 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go
index 4f6fadef4..4542f8e7c 100644
--- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go
+++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go
@@ -50,11 +50,15 @@ func osDowngradeLock(file *os.File, _ LockLevel) _ErrorCode {
}
func osReleaseLock(file *os.File, _ LockLevel) _ErrorCode {
- err := unix.Flock(int(file.Fd()), unix.LOCK_UN)
- if err != nil {
- return _IOERR_UNLOCK
+ for {
+ err := unix.Flock(int(file.Fd()), unix.LOCK_UN)
+ if err == nil {
+ return _OK
+ }
+ if err != unix.EINTR {
+ return _IOERR_UNLOCK
+ }
}
- return _OK
}
func osCheckReservedLock(file *os.File) (bool, _ErrorCode) {
@@ -89,13 +93,18 @@ func osLock(file *os.File, typ int16, start, len int64, def _ErrorCode) _ErrorCo
}
func osUnlock(file *os.File, start, len int64) _ErrorCode {
- err := unix.FcntlFlock(file.Fd(), unix.F_SETLK, &unix.Flock_t{
+ lock := unix.Flock_t{
Type: unix.F_UNLCK,
Start: start,
Len: len,
- })
- if err != nil {
- return _IOERR_UNLOCK
}
- return _OK
+ for {
+ err := unix.FcntlFlock(file.Fd(), unix.F_SETLK, &lock)
+ if err == nil {
+ return _OK
+ }
+ if err != unix.EINTR {
+ return _IOERR_UNLOCK
+ }
+ }
}