Fixed bug 1426 - SDL_SemWaitTimeout returns -1 and sets error instead of SDL_MUTEX_TIMEDOUT on time out

deraj 2012-02-19 19:01:08 PST

Fix to treat ETIMEDOUT as a time out instead of an error (and update the test)
This commit is contained in:
Sam Lantinga 2012-02-20 23:51:53 -05:00
parent 38463b3a0c
commit 099dd8f095
2 changed files with 11 additions and 2 deletions

View file

@ -150,7 +150,11 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
} while (retval < 0 && errno == EINTR);
if (retval < 0) {
SDL_SetError("sem_timedwait() failed");
if (errno == ETIMEDOUT) {
retval = SDL_MUTEX_TIMEDOUT;
} else {
SDL_SetError(strerror(errno));
}
}
#else
end = SDL_GetTicks() + timeout;