mdbx-windows: попытка борьбы с ложно-положительными конфликтами LockFileEx().

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-11-03 12:57:18 +03:00
parent 28e2e31949
commit 91a6e84cab

View File

@ -203,6 +203,16 @@ int mdbx_txn_lock(MDBX_env *env, bool dontwait) {
dontwait ? (LCK_EXCLUSIVE | LCK_DONTWAIT)
: (LCK_EXCLUSIVE | LCK_WAITFOR),
DXB_BODY);
if (rc == ERROR_LOCK_VIOLATION && dontwait) {
SleepEx(0, true);
rc = flock_with_event(env->me_fd4data, env->me_data_lock_event,
LCK_EXCLUSIVE | LCK_DONTWAIT, DXB_BODY);
if (rc == ERROR_LOCK_VIOLATION) {
SleepEx(0, true);
rc = flock_with_event(env->me_fd4data, env->me_data_lock_event,
LCK_EXCLUSIVE | LCK_DONTWAIT, DXB_BODY);
}
}
if (rc == MDBX_SUCCESS)
return rc;