[Mesa-dev] [PATCH 1/4] gallium/os: Fix os_time_sleep() on Windows for small durations.
jfonseca at vmware.com
jfonseca at vmware.com
Thu Dec 6 05:17:06 PST 2012
From: José Fonseca <jfonseca at vmware.com>
Prevents undetermined sleeps.
---
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 4055125..f943e0f 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
--
1.7.9.5
More information about the mesa-dev
mailing list