From 188d28f054dbc9d8897a99d2213d8895922fc330 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:46:23 +0200 Subject: [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] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../ncruces/go-sqlite3/vfs/os_windows.go | 32 ++++++++++------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go') 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 } } -- cgit v1.2.3