libsdl 1.2 SDL_SemWaitTimeout incorrect behavior
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libsdl1.2 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
release: 14.04.1 LTS
version: 1.2.15-8ubuntu1.1 0
The function SDL_SemWaitTimeout returns an error result (-1) if the semaphore wait times out, when it should return SDL_MUTEX_TIMEDOUT per documentation.
Ref: http://
The fix is to check for ETIMEDOUT value of errno:
diff -ru libsdl1.
--- libsdl1.
+++ libsdl1.
@@ -144,8 +144,12 @@
while (retval == -1 && errno == EINTR);
- if (retval == -1)
- SDL_SetError(
+ if (retval == -1) {
+ if (errno == ETIMEDOUT)
+ retval = SDL_MUTEX_TIMEDOUT;
+ else
+ SDL_SetError(
+ }
#else
end = SDL_GetTicks() + timeout;
while ((retval = SDL_SemTryWait(
Should be noted, this bug fix is already in the head of SDL 1.2:
http:// hg.libsdl. org/SDL/ file/bda7de312f bd/src/ thread/ pthread/ SDL_syssem. c