From 10ffa28a28b3b8759565b6987a42501165ac0085 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 6 Sep 2013 20:45:08 -0700 Subject: [PATCH] Fixed time comparison and explicitly delay 1 ms instead of an arbitrary scheduled time. --- src/thread/pthread/SDL_syssem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thread/pthread/SDL_syssem.c b/src/thread/pthread/SDL_syssem.c index 91932f64c..b10f9b0df 100644 --- a/src/thread/pthread/SDL_syssem.c +++ b/src/thread/pthread/SDL_syssem.c @@ -156,10 +156,10 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) #else end = SDL_GetTicks() + timeout; while ((retval = SDL_SemTryWait(sem)) == SDL_MUTEX_TIMEDOUT) { - if (SDL_GetTicks() >= end) { + if ((Sint32)(SDL_GetTicks() - end) >= 0) { break; } - SDL_Delay(0); + SDL_Delay(1); } #endif /* HAVE_SEM_TIMEDWAIT */