gallium/os: Fix os_time_sleep() on Windows for small durations.

Prevents undetermined sleeps.

Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
José Fonseca 2012-12-04 19:44:08 +00:00
parent d8069b7603
commit 7e14293556
1 changed files with 5 additions and 1 deletions

View File

@ -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