diff options
author | Sam Lantinga <slouken@libsdl.org> | 2012-02-20 23:51:53 -0500 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2012-02-20 23:51:53 -0500 |
commit | c88b732fdc191c5a4b7c421781eb2011bd46663e (patch) | |
tree | 38b33f752d40f7430629361bc5465f06890a6b12 /src | |
parent | 9da2e284ddb311b3a41740c113f089b4eb694113 (diff) |
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)
Diffstat (limited to 'src')
-rwxr-xr-x | src/thread/pthread/SDL_syssem.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/thread/pthread/SDL_syssem.c b/src/thread/pthread/SDL_syssem.c index 01d8f461..91959c1b 100755 --- a/src/thread/pthread/SDL_syssem.c +++ b/src/thread/pthread/SDL_syssem.c @@ -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; |