[Mesa-dev] [PATCH 1/4] gallium/os: Fix os_time_sleep() on Windows for small durations.

Brian Paul brianp at vmware.com
Thu Dec 6 07:02:27 PST 2012


On 12/06/2012 06:17 AM, jfonseca at vmware.com wrote:
> 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

For the series:
Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list