Skip to content

Commit

Permalink
Fixed time comparison and explicitly delay 1 ms instead of an arbitra…
Browse files Browse the repository at this point in the history
…ry scheduled time.
  • Loading branch information
slouken committed Sep 7, 2013
1 parent f06eeb0 commit 10ffa28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/thread/pthread/SDL_syssem.c
Expand Up @@ -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 */

Expand Down

0 comments on commit 10ffa28

Please sign in to comment.