summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/storage_lmdb.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp
index b9a007d..ce77bbb 100644
--- a/common/storage_lmdb.cpp
+++ b/common/storage_lmdb.cpp
@@ -8,6 +8,7 @@
8#include <QReadWriteLock> 8#include <QReadWriteLock>
9#include <QString> 9#include <QString>
10#include <QTime> 10#include <QTime>
11#include <QMutex>
11 12
12#include <lmdb.h> 13#include <lmdb.h>
13 14
@@ -26,8 +27,11 @@ public:
26 AccessMode mode; 27 AccessMode mode;
27 bool readTransaction; 28 bool readTransaction;
28 bool firstOpen; 29 bool firstOpen;
30 static QMutex sMutex;
29}; 31};
30 32
33QMutex Storage::Private::sMutex;
34
31Storage::Private::Private(const QString &s, const QString &n, AccessMode m) 35Storage::Private::Private(const QString &s, const QString &n, AccessMode m)
32 : storageRoot(s), 36 : storageRoot(s),
33 name(n), 37 name(n),
@@ -41,6 +45,9 @@ Storage::Private::Private(const QString &s, const QString &n, AccessMode m)
41 dir.mkdir(storageRoot); 45 dir.mkdir(storageRoot);
42 dir.mkdir(fullPath); 46 dir.mkdir(fullPath);
43 47
48 //This seems to resolve threading related issues, not sure why though
49 QMutexLocker locker(&sMutex);
50
44 //create file 51 //create file
45 if (mdb_env_create(&env)) { 52 if (mdb_env_create(&env)) {
46 // TODO: handle error 53 // TODO: handle error