On 11/11/2016 06:47 PM, Vinson Lee wrote:
Fix MinGW warning.piglit-util.c: In function 'piglit_delay_ns': piglit-util.c:634:2: warning: implicit declaration of function 'usleep' [-Wimplicit-function-declaration] usleep(time_ns / 1000); ^~~~~~ Fixes: e0048f4940f7 ("util: Add piglit_delay_ns() api") Signed-off-by: Vinson Lee <[email protected]> --- tests/util/piglit-util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c index 6b34c46f8549..08fa66b5f2d0 100644 --- a/tests/util/piglit-util.c +++ b/tests/util/piglit-util.c @@ -630,6 +630,8 @@ piglit_delay_ns(int64_t time_ns) while (nanosleep(&ts, &ts) == -1 && errno == EINTR) ; +#elif defined(_WIN32) + Sleep(time_ns / 1000 / 1000); #else usleep(time_ns / 1000); #endif
That'll fix the warning, but there's a deeper issue. Clearly, implementing piglit_delay_ns() with a millisecond Sleep call isn't a great solution.
It doesn't look like Windows has a good way to implement nanosecond sleeps and I'm not sure nanosecond sleeps are practical anyway.
Alternately, we could replace this function with a piglit_delay_ms() which is more tractable. The only caller of this function asks for a 1s delay anyway.
Cc'ing Robert Bragg, the original author of this code for comments. -Brian _______________________________________________ Piglit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/piglit
