Fixed time comparison and explicitly delay 1 ms instead of an arbitrary scheduled time.

Sam Lantinga 2013-09-06 20:45:08 -07:00
parent f06eeb013b
commit 10ffa28a28
1 changed files with 2 additions and 2 deletions

View File

@ -156,10 +156,10 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
#else #else
end = SDL_GetTicks() + timeout; end = SDL_GetTicks() + timeout;
while ((retval = SDL_SemTryWait(sem)) == SDL_MUTEX_TIMEDOUT) { while ((retval = SDL_SemTryWait(sem)) == SDL_MUTEX_TIMEDOUT) {
if (SDL_GetTicks() >= end) { if ((Sint32)(SDL_GetTicks() - end) >= 0) {
break; break;
} }
SDL_Delay(0); SDL_Delay(1);
} }
#endif /* HAVE_SEM_TIMEDWAIT */ #endif /* HAVE_SEM_TIMEDWAIT */