[PATCH v8 1/8] nptl: Add C11 threads thrd_* functions

Adhemerval Zanella adhemerval.zanella@linaro.org
Thu Jul 12 19:32:00 GMT 2018



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).



More information about the Libc-alpha mailing list