This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]