mdbx-test: minor cleanup osal_delay() for Windows.

Change-Id: If9c57cc1eba4c873be5d9176f7f6745c2363a0d6
This commit is contained in:
Leonid Yuriev 2020-04-16 19:14:57 +03:00
parent 971f924c44
commit 5d7d45f0e5

View File

@ -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.
*
@ -424,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);
}