| Summary: | correct error checks for pthread functions | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Andreas Wiese <aw-libsdl> |
| Component: | thread | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | icculus, sezeroz |
| Version: | HG 2.1 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Attachments: | fix pthread return checks | ||
This patch is now https://hg.libsdl.org/SDL/rev/ecddbd9fe6b5, thanks! --ryan. |
Created attachment 3131 [details] fix pthread return checks The pthread threading implementation does some error checks wrong. Nearly all pthread_*() functions returning int on success are defined to "return zero. Otherwise, an error number is returned to indicate the error", followed by a list of error conditions and their error values as "errno"s. This does not say anything about the sign of the error codes and indeed, most libc implementations have positive errnos. Thus correct error checking should not test for ret < 0, but for ret != 0, as otherwise the error check might be noneffective depending on used libc implementation.