This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v8 1/8] nptl: Add C11 threads thrd_* functions
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: Florian Weimer <fweimer at redhat dot com>, libc-alpha at sourceware dot org
- Date: Thu, 12 Jul 2018 16:32:45 -0300
- Subject: Re: [PATCH v8 1/8] nptl: Add C11 threads thrd_* functions
- References: <1517591084-11347-1-git-send-email-adhemerval.zanella@linaro.org> <1517591084-11347-2-git-send-email-adhemerval.zanella@linaro.org> <c6e9640b-182a-71ac-2417-838fdeeb2465@redhat.com> <c834f9a0-0441-35f4-abff-4a283a2baf25@linaro.org>
On 12/07/2018 14:52, Adhemerval Zanella wrote:
>
>
> On 12/07/2018 13:46, Florian Weimer wrote:
>> On 02/02/2018 06:04 PM, Adhemerval Zanella wrote:
>>> +int
>>> +thrd_join (thrd_t thr, int *res)
>>> +{
>>> + void *pthread_res;
>>> + int err_code = __pthread_join (thr, &pthread_res);
>>> + if (res)
>>> + *res = (int)((uintptr_t) pthread_res);
>>> +
>>> + return thrd_err_map (err_code);
>>> +}
>>
>> Slight inconsistency with intptr_t above.
>
> Indeed, it seems there is no need to cast.
In fact the cast this construction is still required, since the pthread_join
returned value might have a different size of the expected c11 thrd_join.
As a slight optimization I changed to
int err_code = __pthread_timedjoin_ex (thr, &pthread_res, NULL, true);
(it should avoid calling pthread_join which will in turn call
pthread_timedjoin_ex).