aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <[email protected]>2017-06-28 17:13:35 +0200
committerDaniel Vrátil <[email protected]>2017-06-28 17:13:35 +0200
commit3f2e8fb3287f4c69525aa7d2d3db0482c1245078 (patch)
treea92270976a636753da81a189a5eb9e876fdbd836
parent244313a36837fd828fbd2d8bb2eab1d4e0b6eaa1 (diff)
Use std::this_thread::sleep_for instead of sleep
-rw-r--r--xapian/xapiandatabase.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/xapian/xapiandatabase.cpp b/xapian/xapiandatabase.cpp
index 9917643..80c505c 100644
--- a/xapian/xapiandatabase.cpp
+++ b/xapian/xapiandatabase.cpp
@@ -28,11 +28,10 @@
#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#endif
-#ifdef WIN32
-#include <Windows.h>
-#else
-#include <unistd.h>
-#endif
+
+#include <chrono>
+#include <thread>
+
using namespace Akonadi::Search;
XapianDatabase::XapianDatabase(const QString &path, bool writeOnly)
@@ -177,17 +176,9 @@ Xapian::WritableDatabase XapianDatabase::createWritableDb()
Xapian::WritableDatabase wdb(m_path, Xapian::DB_CREATE_OR_OPEN);
return wdb;
} catch (const Xapian::DatabaseLockError &) {
-#ifdef WIN32
- Sleep(i * 50 * 1000);
-#else
- usleep(i * 50 * 1000);
-#endif
+ std::this_thread::sleep_for(std::chrono::milliseconds(i * 50));
} catch (const Xapian::DatabaseModifiedError &) {
-#ifdef WIN32
- Sleep(i * 50 * 1000);
-#else
- usleep(i * 50 * 1000);
-#endif
+ std::this_thread::sleep_for(std::chrono::milliseconds(i * 50));
} catch (const Xapian::DatabaseCreateError &err) {
qCDebug(AKONADI_SEARCH_XAPIAN_LOG) << err.get_error_string();
return Xapian::WritableDatabase();