On Sun, Aug 09, 2020 at 03:41:04PM +0000, Myah Caron wrote:
Sleep(1) should sleep until the next kernel tick, not necessarily one millisecond.
Thanks to Henri Verbeet for pointing this out.
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=49564 Signed-off-by: Myah Caron qsniyg@protonmail.com
v2: Relax the upper bound, improve wording for commit details
dlls/kernelbase/tests/sync.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
diff --git a/dlls/kernelbase/tests/sync.c b/dlls/kernelbase/tests/sync.c index 9f57cf7a95..50ce62602b 100644 --- a/dlls/kernelbase/tests/sync.c +++ b/dlls/kernelbase/tests/sync.c @@ -172,6 +172,31 @@ static void test_WaitOnAddress(void) ok(!address, "got unexpected value %s\n", wine_dbgstr_longlong(address)); }
+static void test_Sleep(void) +{
- LARGE_INTEGER frequency;
- LARGE_INTEGER t1, t2;
- double elapsed_time;
- BOOL ret;
- int i;
- ret = QueryPerformanceFrequency(&frequency);
- ok(ret, "QueryPerformanceFrequency failed\n");
- ret = QueryPerformanceCounter(&t1);
- ok(ret, "QueryPerformanceCounter failed\n");
- for (i = 0; i < 100; i++) {
Sleep(1);
- }
- ret = QueryPerformanceCounter(&t2);
- ok(ret, "QueryPerformanceCounter failed\n");
- elapsed_time = (t2.QuadPart - t1.QuadPart) / (double)frequency.QuadPart;
- todo_wine ok(elapsed_time >= 1.5 && elapsed_time <= 4.0, "got %f\n", elapsed_time);
+}
Hey,
Seem like my patch passes this test: https://www.winehq.org/pipermail/wine-devel/2020-August/171496.html
I have applied both changes, removed todo_wine and run a few minutes of:
while ./wine dlls/kernelbase/tests/kernelbase_test.exe sync; do done
with zero failures.