summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdb/src/stdafx.h
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-02-20 12:48:13 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-02-20 12:48:13 +0000
commitd363c51d46ee4cd1775ea5b28a50b80175e25dcc (patch)
tree633673262bd2cbf8dfbd2010ce8cc99b2711626a /plugins/Dbx_mdb/src/stdafx.h
parentf764743b3f58209720f3c9d97884f05eed642150 (diff)
dbx_lmdb: speed optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@16314 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/stdafx.h')
-rw-r--r--plugins/Dbx_mdb/src/stdafx.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/plugins/Dbx_mdb/src/stdafx.h b/plugins/Dbx_mdb/src/stdafx.h
index 0a777f5e5b..793c25b6f0 100644
--- a/plugins/Dbx_mdb/src/stdafx.h
+++ b/plugins/Dbx_mdb/src/stdafx.h
@@ -79,22 +79,16 @@ public:
class txn_ptr_ro
{
- static MDB_txn *m_txn;
-
+ MDB_txn *m_txn;
public:
- __forceinline txn_ptr_ro(MDB_env *pEnv)
+ __forceinline txn_ptr_ro(MDB_txn *&txn) : m_txn(txn)
{
- if (!m_txn)
- mdb_txn_begin(pEnv, NULL, MDB_RDONLY, &m_txn);
- else
- mdb_txn_renew(m_txn);
+ mdb_txn_renew(m_txn);
}
-
__forceinline ~txn_ptr_ro()
{
mdb_txn_reset(m_txn);
}
-
__forceinline operator MDB_txn*() const { return m_txn; }
};
@@ -118,6 +112,17 @@ public:
__forceinline operator MDB_cursor*() const { return m_cursor; }
};
+class cursor_ptr_ro
+{
+ MDB_cursor *m_cursor;
+public:
+ __forceinline cursor_ptr_ro(MDB_cursor *&cursor) : m_cursor(cursor)
+ {
+ mdb_cursor_renew(mdb_cursor_txn(m_cursor), m_cursor); //--
+ }
+ __forceinline operator MDB_cursor*() const { return m_cursor; }
+};
+
#define MDB_CHECK(A,B) \
switch(A) { \
case MDB_SUCCESS: break; \