diff options
author | José Fonseca <jfonseca@vmware.com> | 2012-12-04 19:44:08 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2012-12-06 17:12:31 +0000 |
commit | 7e14293556bf8b4248728d2952752c13f70647f3 (patch) | |
tree | d622d0e03ab6f6efa56323212deb4890231932fc /src/gallium/auxiliary/os/os_time.c | |
parent | d8069b7603c368c59e7a605d696d2bd65ad414f6 (diff) |
gallium/os: Fix os_time_sleep() on Windows for small durations.
Prevents undetermined sleeps.
Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/os/os_time.c')
-rw-r--r-- | src/gallium/auxiliary/os/os_time.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/os/os_time.c b/src/gallium/auxiliary/os/os_time.c index 40551252b2..f943e0f316 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 |