Fixed time comparison and explicitly delay 1 ms instead of an arbitrary scheduled time.
authorSam Lantinga <slouken@libsdl.org>
Fri, 06 Sep 2013 20:45:08 -0700
changeset 7732 4c0e4274c3f8
parent 7731 9cbe58c01e31
child 7733 957d7137867c
Fixed time comparison and explicitly delay 1 ms instead of an arbitrary scheduled time.
src/thread/pthread/SDL_syssem.c
--- a/src/thread/pthread/SDL_syssem.c	Thu Sep 05 15:49:57 2013 -0700
+++ b/src/thread/pthread/SDL_syssem.c	Fri Sep 06 20:45:08 2013 -0700
@@ -156,10 +156,10 @@
 #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 */