From 7e14293556bf8b4248728d2952752c13f70647f3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 4 Dec 2012 19:44:08 +0000 Subject: [PATCH] gallium/os: Fix os_time_sleep() on Windows for small durations. Prevents undetermined sleeps. Reviewed-by: Brian Paul --- src/gallium/auxiliary/os/os_time.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/os/os_time.c b/src/gallium/auxiliary/os/os_time.c index 40551252b25..f943e0f3162 100644 --- a/src/gallium/auxiliary/os/os_time.c +++ b/src/gallium/auxiliary/os/os_time.c @@ -88,7 +88,11 @@ os_time_get_nano(void) void os_time_sleep(int64_t usecs) { - Sleep((usecs + 999) / 1000); + DWORD dwMilliseconds = (usecs + 999) / 1000; + /* Avoid Sleep(O) as that would cause to sleep for an undetermined duration */ + if (dwMilliseconds) { + Sleep(dwMilliseconds); + } } #endif -- 2.30.2