mirror of
https://github.com/isar/libmdbx.git
synced 2025-02-06 04:28:21 +08:00
mdbx: disable non-blocking DB-close under Windows.
Change-Id: If6579467132439b6b627e756f67f6bd35fed8b4f
This commit is contained in:
parent
634efbe34b
commit
efdcbd8c35
13
src/mdbx.c
13
src/mdbx.c
@ -5945,8 +5945,19 @@ int __cold mdbx_env_close_ex(MDBX_env *env, int dont_sync) {
|
|||||||
env->me_txn0->mt_owner != mdbx_thread_self())
|
env->me_txn0->mt_owner != mdbx_thread_self())
|
||||||
return MDBX_BUSY;
|
return MDBX_BUSY;
|
||||||
if (!dont_sync) {
|
if (!dont_sync) {
|
||||||
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
|
/* On windows, without blocking is impossible to determine whether another
|
||||||
|
* process is running a writing transaction or not.
|
||||||
|
* Because in the "owner died" condition kernel don't release
|
||||||
|
* file lock immediately. */
|
||||||
|
rc = mdbx_env_sync_ex(env, true, false);
|
||||||
|
#else
|
||||||
rc = mdbx_env_sync_ex(env, true, true);
|
rc = mdbx_env_sync_ex(env, true, true);
|
||||||
rc = (rc == MDBX_BUSY) ? MDBX_SUCCESS : rc;
|
rc = (rc == MDBX_BUSY || rc == EAGAIN || rc == EACCES || rc == EBUSY ||
|
||||||
|
rc == EWOULDBLOCK)
|
||||||
|
? MDBX_SUCCESS
|
||||||
|
: rc;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user