From 91920e7c3b450e2ba39ef4c16707f836df82d948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Mon, 11 Nov 2019 21:21:06 +0100 Subject: [PATCH] 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. --- lmdb-safe.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lmdb-safe.cc b/lmdb-safe.cc index 1c46d56..530389a 100644 --- a/lmdb-safe.cc +++ b/lmdb-safe.cc @@ -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