summaryrefslogtreecommitdiff
path: root/libs/libmdbx/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-02-21 20:38:41 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-02-21 20:38:41 +0300
commitedc63a4144e490bf5b8b4aba778a7896c82249ef (patch)
treef52a6d2e5ff8f37f344198575941982c76aa4656 /libs/libmdbx/src
parent45b1e1555bd76a8cad24c854a3c705c8cf1f356a (diff)
libmdbx: crutch for wine
Diffstat (limited to 'libs/libmdbx/src')
-rw-r--r--libs/libmdbx/src/src/elements/lck-windows.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/libs/libmdbx/src/src/elements/lck-windows.c b/libs/libmdbx/src/src/elements/lck-windows.c
index 2d4c7d1a94..6a2142ea88 100644
--- a/libs/libmdbx/src/src/elements/lck-windows.c
+++ b/libs/libmdbx/src/src/elements/lck-windows.c
@@ -367,22 +367,24 @@ mdbx_resume_threads_after_remap(mdbx_handle_array_t *array) {
*/
static void lck_unlock(MDBX_env *env) {
- int rc;
+ int err;
if (env->me_lfd != INVALID_HANDLE_VALUE) {
/* double `unlock` for robustly remove overlapped shared/exclusive locks */
while (funlock(env->me_lfd, LCK_LOWER))
;
- rc = GetLastError();
- assert(rc == ERROR_NOT_LOCKED);
- (void)rc;
+ err = GetLastError();
+ assert(err == ERROR_NOT_LOCKED ||
+ (mdbx_RunningUnderWine() && err == ERROR_LOCK_VIOLATION));
+ (void)err;
SetLastError(ERROR_SUCCESS);
while (funlock(env->me_lfd, LCK_UPPER))
;
- rc = GetLastError();
- assert(rc == ERROR_NOT_LOCKED);
- (void)rc;
+ err = GetLastError();
+ assert(err == ERROR_NOT_LOCKED ||
+ (mdbx_RunningUnderWine() && err == ERROR_LOCK_VIOLATION));
+ (void)err;
SetLastError(ERROR_SUCCESS);
}
@@ -391,23 +393,26 @@ static void lck_unlock(MDBX_env *env) {
* releases such locks via deferred queues) */
while (funlock(env->me_lazy_fd, LCK_BODY))
;
- rc = GetLastError();
- assert(rc == ERROR_NOT_LOCKED);
- (void)rc;
+ err = GetLastError();
+ assert(err == ERROR_NOT_LOCKED ||
+ (mdbx_RunningUnderWine() && err == ERROR_LOCK_VIOLATION));
+ (void)err;
SetLastError(ERROR_SUCCESS);
while (funlock(env->me_lazy_fd, LCK_META))
;
- rc = GetLastError();
- assert(rc == ERROR_NOT_LOCKED);
- (void)rc;
+ err = GetLastError();
+ assert(err == ERROR_NOT_LOCKED ||
+ (mdbx_RunningUnderWine() && err == ERROR_LOCK_VIOLATION));
+ (void)err;
SetLastError(ERROR_SUCCESS);
while (funlock(env->me_lazy_fd, LCK_WHOLE))
;
- rc = GetLastError();
- assert(rc == ERROR_NOT_LOCKED);
- (void)rc;
+ err = GetLastError();
+ assert(err == ERROR_NOT_LOCKED ||
+ (mdbx_RunningUnderWine() && err == ERROR_LOCK_VIOLATION));
+ (void)err;
SetLastError(ERROR_SUCCESS);
}
}