On Thu, Oct 8, 2015 at 4:29 PM, Rémi Denis-Courmont <[email protected]> wrote:
> Le 2015-10-08 17:21, Hendrik Leppkes a écrit :
>>
>> pthread is a bit of a exception. All its functions can return errors,
>> but the only time they would is if you pass in an invalid argument.
>
>
>> No-one checks return values of pthread_mutex_lock, for example.
>
>
> That is not true. Plenty of projects check for errors there for debugging.
>
>> Only functions worthy of checking are the related init functions.
>
>
> I have to disagree pretty much totally here.
>
> POSIX thread errors on use (lock, unlock, signal, wait, etc) and destroy
> functions should be checked via assertions. I found quite a few bugs in
> other projects thanks to that. In debug builds, error detection can be
> further improved with the error-checking mutex type instead of the default.
>
> On the other hand, checking init functions is useless. Any sane POSIX thread
> implementation will just initialize memory and always return 0 (glibc does
> that, probably musl too). Errors are only specified to allow naive POSIX
> implementations to allocate resources; reasonable implementations allocate
> all needed resources when creating processes and threads.
>
> Except for the ETIMEDOUT error, the only really possible failure case is
> pthread_create().
>

So, you don't disagree that much afterall, since only pthread_create can fail?
Confusing, you are.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to