mdbx: fix/rework exclusive-locking for Windows.

Change-Id: I1b129a10ed7523024481480647317f1643f2ea70
This commit is contained in:
Leonid Yuriev
2017-07-19 09:12:46 +03:00
committed by Leo Yuriev
parent 17e8429a29
commit c8a5df650b
4 changed files with 43 additions and 26 deletions

View File

@@ -4906,11 +4906,14 @@ int __cold mdbx_env_open_ex(MDBX_env *env, const char *path, unsigned flags,
if (exclusive == NULL || *exclusive < 2) {
/* LY: downgrade lock only if exclusive access not requested.
* in case exclusive==1, just leave value as is. */
rc = mdbx_lck_downgrade(env);
mdbx_debug("lck-downgrade: rc %i ", rc);
if (rc != MDBX_SUCCESS)
goto bailout;
rc = mdbx_lck_downgrade(env, true);
mdbx_debug("lck-downgrade-full: rc %i ", rc);
} else {
rc = mdbx_lck_downgrade(env, false);
mdbx_debug("lck-downgrade-partial: rc %i ", rc);
}
if (rc != MDBX_SUCCESS)
goto bailout;
} else {
if (exclusive) {
/* LY: just indicate that is not an exclusive access. */