diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-21 19:23:44 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-21 19:23:44 +0300 |
commit | 3e13ce3fdfc8a15be4b10a6e8d9ccb40e7d3bc0a (patch) | |
tree | 012d020322f2c344cff1c7b682e196c217d181cc /libs/libmdbx | |
parent | 7bff3e1aac8de58db4817117f1c5605deeb48228 (diff) |
libmdbx: minor fix for concurrent database creation
Diffstat (limited to 'libs/libmdbx')
-rw-r--r-- | libs/libmdbx/src/src/defs.h | 10 | ||||
-rw-r--r-- | libs/libmdbx/src/src/mdbx.c | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/libs/libmdbx/src/src/defs.h b/libs/libmdbx/src/src/defs.h index 4b045efc1d..fb60b310ef 100644 --- a/libs/libmdbx/src/src/defs.h +++ b/libs/libmdbx/src/src/defs.h @@ -103,15 +103,15 @@ /*----------------------------------------------------------------------------*/ -#ifndef __alwaysinline +#ifndef __always_inline # if defined(__GNUC__) || __has_attribute(always_inline) -# define __alwaysinline __inline __attribute__((always_inline)) +# define __always_inline __inline __attribute__((always_inline)) # elif defined(_MSC_VER) -# define __alwaysinline __forceinline +# define __always_inline __forceinline # else -# define __alwaysinline +# define __always_inline # endif -#endif /* __alwaysinline */ +#endif /* __always_inline */ #ifndef __noinline # if defined(__GNUC__) || __has_attribute(noinline) diff --git a/libs/libmdbx/src/src/mdbx.c b/libs/libmdbx/src/src/mdbx.c index 4a34233184..92e1b5c630 100644 --- a/libs/libmdbx/src/src/mdbx.c +++ b/libs/libmdbx/src/src/mdbx.c @@ -12100,19 +12100,19 @@ int mdbx_dbi_open_ex(MDBX_txn *txn, const char *table_name, unsigned user_flags, bailout: mdbx_free(namedup); } else { - txn->mt_dbiseqs[slot] = (env->me_dbiseqs[slot] += 1); txn->mt_dbflags[slot] = (uint8_t)dbflag; txn->mt_dbxs[slot].md_name.iov_base = namedup; - mdbx_compiler_barrier(); txn->mt_dbxs[slot].md_name.iov_len = len; - if (slot == txn->mt_numdbs) - txn->mt_numdbs++; + txn->mt_numdbs += (slot == txn->mt_numdbs); if ((dbflag & DB_CREAT) == 0) { env->me_dbflags[slot] = txn->mt_dbs[slot].md_flags | MDBX_VALID; mdbx_compiler_barrier(); if (env->me_numdbs <= slot) env->me_numdbs = slot + 1; + } else { + env->me_dbiseqs[slot] += 1; } + txn->mt_dbiseqs[slot] = env->me_dbiseqs[slot]; *dbi = slot; } |