Allow reader and writer transactions in the same thread

This is supported by LMDB if the MDB_NOTLS flag is set on the
environment, which it always is with lmdb-safe.

Fixes #9.
This commit is contained in:
Jonas Schäfer 2019-11-11 21:21:06 +01:00 committed by Martchus
parent 551339ff8f
commit 91920e7c3b
1 changed files with 1 additions and 1 deletions

View File

@ -163,7 +163,7 @@ MDBRWTransactionImpl::MDBRWTransactionImpl(MDBEnv *parent, MDB_txn *txn):
MDB_txn *MDBRWTransactionImpl::openRWTransaction(MDBEnv *env, MDB_txn *parent, unsigned int flags)
{
MDB_txn *result;
if(env->getROTX() || env->getRWTX())
if(env->getRWTX())
throw std::runtime_error("Duplicate RW transaction");
for(int tries =0 ; tries < 3; ++tries) { // it might happen twice, who knows