summaryrefslogtreecommitdiff
path: root/vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-09-30 12:46:23 +0200
committerLibravatar GitHub <noreply@github.com>2024-09-30 12:46:23 +0200
commit188d28f054dbc9d8897a99d2213d8895922fc330 (patch)
tree2691665ad2e129ed7a07ea468024cc7db5005a54 /vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go
parent[bugfix] Carry-over "PinnedAt" when refreshing status (#3373) (diff)
downloadgotosocial-188d28f054dbc9d8897a99d2213d8895922fc330.tar.xz
[chore]: Bump github.com/ncruces/go-sqlite3 from 0.18.3 to 0.18.4 (#3375)
Bumps [github.com/ncruces/go-sqlite3](https://github.com/ncruces/go-sqlite3) from 0.18.3 to 0.18.4. - [Release notes](https://github.com/ncruces/go-sqlite3/releases) - [Commits](https://github.com/ncruces/go-sqlite3/compare/v0.18.3...v0.18.4) --- updated-dependencies: - dependency-name: github.com/ncruces/go-sqlite3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go')
-rw-r--r--vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go32
1 files changed, 14 insertions, 18 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go
index 4cad777d3..4f6149ba3 100644
--- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go
+++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go
@@ -28,27 +28,25 @@ func osGetReservedLock(file *os.File) _ErrorCode {
return osWriteLock(file, _RESERVED_BYTE, 1, 0)
}
-func osGetPendingLock(file *os.File, block bool) _ErrorCode {
- var timeout time.Duration
- if block {
- timeout = -1
- }
-
- // Acquire the PENDING lock.
- return osWriteLock(file, _PENDING_BYTE, 1, timeout)
-}
-
-func osGetExclusiveLock(file *os.File, block bool) _ErrorCode {
- var timeout time.Duration
- if block {
- timeout = time.Millisecond
+func osGetExclusiveLock(file *os.File, state *LockLevel) _ErrorCode {
+ // A PENDING lock is needed before releasing the SHARED lock.
+ if *state < LOCK_PENDING {
+ // If we were RESERVED, we can block indefinitely.
+ var timeout time.Duration
+ if *state == LOCK_RESERVED {
+ timeout = -1
+ }
+ if rc := osWriteLock(file, _PENDING_BYTE, 1, timeout); rc != _OK {
+ return rc
+ }
+ *state = LOCK_PENDING
}
// Release the SHARED lock.
osUnlock(file, _SHARED_FIRST, _SHARED_SIZE)
// Acquire the EXCLUSIVE lock.
- rc := osWriteLock(file, _SHARED_FIRST, _SHARED_SIZE, timeout)
+ rc := osWriteLock(file, _SHARED_FIRST, _SHARED_SIZE, time.Millisecond)
if rc != _OK {
// Reacquire the SHARED lock.
@@ -64,9 +62,7 @@ func osDowngradeLock(file *os.File, state LockLevel) _ErrorCode {
// Reacquire the SHARED lock.
if rc := osReadLock(file, _SHARED_FIRST, _SHARED_SIZE, 0); rc != _OK {
- // This should never happen.
- // We should always be able to reacquire the read lock.
- // notest
+ // notest // this should never happen
return _IOERR_RDLOCK
}
}