From cb0f5fb769380db5771ff8e0dba8d780cdc92edb Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 14 Dec 2014 23:39:48 +0100 Subject: Make lmdb work with threads. --- tests/storagetest.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp index b3313c0..3c20135 100644 --- a/tests/storagetest.cpp +++ b/tests/storagetest.cpp @@ -126,15 +126,16 @@ private Q_SLOTS: populate(count); + bool error = false; //Try to concurrently read QList > futures; - const int concurrencyLevel = 4; + const int concurrencyLevel = 10; for (int num = 0; num < concurrencyLevel; num++) { - futures << QtConcurrent::run([this, count](){ + futures << QtConcurrent::run([this, count, &error](){ Storage storage(testDataPath, dbName); for (int i = 0; i < count; i++) { if (!verify(storage, i)) { - qWarning() << "invalid value"; + error = true; break; } } @@ -143,6 +144,7 @@ private Q_SLOTS: for(auto future : futures) { future.waitForFinished(); } + QVERIFY(!error); Storage storage(testDataPath, dbName); storage.removeFromDisk(); -- cgit v1.2.3