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 77324c0e4274c3f8
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
     1.1 --- a/src/thread/pthread/SDL_syssem.c	Thu Sep 05 15:49:57 2013 -0700
     1.2 +++ b/src/thread/pthread/SDL_syssem.c	Fri Sep 06 20:45:08 2013 -0700
     1.3 @@ -156,10 +156,10 @@
     1.4  #else
     1.5      end = SDL_GetTicks() + timeout;
     1.6      while ((retval = SDL_SemTryWait(sem)) == SDL_MUTEX_TIMEDOUT) {
     1.7 -        if (SDL_GetTicks() >= end) {
     1.8 +        if ((Sint32)(SDL_GetTicks() - end) >= 0) {
     1.9              break;
    1.10          }
    1.11 -        SDL_Delay(0);
    1.12 +        SDL_Delay(1);
    1.13      }
    1.14  #endif /* HAVE_SEM_TIMEDWAIT */
    1.15