Using SDL 1.2.15 on Linux, I’m trying to understand
SDL_SemWaitTimeout’s behavior. It appears to return -1 when I was
(Note: I realize I shouldn’t use SDL_SemWaitTimeout on Linux since it
can be inefficient–I’m removing this dependency–but some previously
released code of mine relies on it)
According to the documentation for SDL_SemWaitTimeout, it should
return 0 if successfully locked, SDL_MUTEX_TIMEDOUT (1) if timed out,
and -1 on error.
However, after debugging in GDB, what I see is the following:
- SDL_SemWaitTimeout calls sem_timedwait and sem_timedwait returns -1
- errno is set to ETIMEDOUT (110)
- SDL_SemWaitTimeout sets the SDL error to “Connection timed out”
- SDL_SemWaitTimeout returns -1
- My app interprets this as a failure instead of a timeout (and
unfortunately my app doesn’t handle this failure very gracefully
Looking at the documentation for sem_timedwait, it fails (-1) and sets
errno=ETIMEDOUT if the timeout expires.
Should this value of errno be interpreted as a timeout and return
SDL_MUTEX_TIMEDOUT from SDL_SemWaitTimeout?
Let me know if you need more info or if it’s not clear what I’m asking.
Thanks in advance!
(Note: I’m not a member of this mailing list)