From: José Fonseca Date: Tue, 4 Dec 2012 19:44:08 +0000 (+0000) Subject: gallium/os: Fix os_time_sleep() on Windows for small durations. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e14293556bf8b4248728d2952752c13f70647f3;p=mesa.git gallium/os: Fix os_time_sleep() on Windows for small durations. Prevents undetermined sleeps. Reviewed-by: Brian Paul --- 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