diff options
author | George Hazan <ghazan@miranda.im> | 2017-11-23 18:11:47 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-11-23 18:11:47 +0300 |
commit | 72ed903dac773db034a187b4ba7f187ef43d717e (patch) | |
tree | 9a5bd012fd7c0b4dd4ae53ae85d601a82dc56c60 /plugins/Dbx_mdb/src/mdbx/lck-windows.c | |
parent | 7d9f19596aec67afaa158af06c5a547029ffdbbf (diff) |
updating lmdbx to the recent stable
Diffstat (limited to 'plugins/Dbx_mdb/src/mdbx/lck-windows.c')
-rw-r--r-- | plugins/Dbx_mdb/src/mdbx/lck-windows.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/Dbx_mdb/src/mdbx/lck-windows.c b/plugins/Dbx_mdb/src/mdbx/lck-windows.c index 66591db912..0582b28d78 100644 --- a/plugins/Dbx_mdb/src/mdbx/lck-windows.c +++ b/plugins/Dbx_mdb/src/mdbx/lck-windows.c @@ -126,10 +126,13 @@ static __inline BOOL funlock(mdbx_filehandle_t fd, uint64_t offset, #define LCK_BODY LCK_BODY_OFFSET, LCK_BODY_LEN #define LCK_WHOLE 0, LCK_MAXLEN -int mdbx_txn_lock(MDBX_env *env) { - if (flock(env->me_fd, LCK_EXCLUSIVE | LCK_WAITFOR, LCK_BODY)) +int mdbx_txn_lock(MDBX_env *env, bool dontwait) { + if (flock(env->me_fd, dontwait ? (LCK_EXCLUSIVE | LCK_DONTWAIT) + : (LCK_EXCLUSIVE | LCK_WAITFOR), + LCK_BODY)) return MDBX_SUCCESS; - return GetLastError(); + int rc = GetLastError(); + return (!dontwait || rc != ERROR_LOCK_VIOLATION) ? rc : MDBX_BUSY; } void mdbx_txn_unlock(MDBX_env *env) { |