summaryrefslogtreecommitdiff
path: root/libs/libmdbx/src/test/osal-windows.cc
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-04-25 11:57:29 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-04-25 11:57:29 +0300
commita4b13dbed9ff21c3b992ee21ba708730186296e4 (patch)
tree41d97e2c924929a9da7d740aa3353598ea9cc64d /libs/libmdbx/src/test/osal-windows.cc
parentc0f6475d8f49a0d97428c674cc3ec938fe78213b (diff)
libmdbx: merge with 0.7 final version
Diffstat (limited to 'libs/libmdbx/src/test/osal-windows.cc')
-rw-r--r--libs/libmdbx/src/test/osal-windows.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/libs/libmdbx/src/test/osal-windows.cc b/libs/libmdbx/src/test/osal-windows.cc
index 6de674651b..9bde047a2c 100644
--- a/libs/libmdbx/src/test/osal-windows.cc
+++ b/libs/libmdbx/src/test/osal-windows.cc
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 Leonid Yuriev <leo@yuriev.ru>
+ * Copyright 2017-2020 Leonid Yuriev <leo@yuriev.ru>
* and other libmdbx authors: please see AUTHORS file.
* All rights reserved.
*
@@ -14,6 +14,8 @@
#include "test.h"
+#if defined(_WIN32) || defined(_WIN64)
+
static std::unordered_map<unsigned, HANDLE> events;
static HANDLE hBarrierSemaphore, hBarrierEvent;
static HANDLE hProgressActiveEvent, hProgressPassiveEvent;
@@ -422,16 +424,10 @@ void osal_udelay(unsigned us) {
static unsigned threshold_us;
if (threshold_us == 0) {
-#if 1
unsigned timeslice_ms = 1;
while (timeBeginPeriod(timeslice_ms) == TIMERR_NOCANDO)
++timeslice_ms;
threshold_us = timeslice_ms * 1500u;
-#else
- ULONGLONG InterruptTimePrecise_100ns;
- QueryInterruptTimePrecise(&InterruptTimePrecise_100ns);
- threshold_us = InterruptTimePrecise_100ns / 5;
-#endif
assert(threshold_us > 0);
}
@@ -459,3 +455,5 @@ std::string osal_tempdir(void) {
int osal_removefile(const std::string &pathname) {
return DeleteFileA(pathname.c_str()) ? MDBX_SUCCESS : GetLastError();
}
+
+#endif /* Windows */