[PATCH 4/6] nptl: Remove INVALID_TD_P
Florian Weimer
fweimer@redhat.com
Thu Dec 18 17:27:08 GMT 2025
* Adhemerval Zanella Netto:
> On 18/12/25 10:50, Florian Weimer wrote:
>> * Adhemerval Zanella:
>>
>>> And use 'joinstate' to get the thread state instead of 'tid'. The
>>> joinstate is set by the kernel when the thread exits.
>>
>>> diff --git a/sysdeps/nptl/pthreadP.h b/sysdeps/nptl/pthreadP.h
>>> index 4b76af7771..0bf44ac003 100644
>>> --- a/sysdeps/nptl/pthreadP.h
>>> +++ b/sysdeps/nptl/pthreadP.h
>>> @@ -217,6 +217,11 @@ libc_hidden_proto (__pthread_current_priority)
>>> nothing. And if the test triggers the thread descriptor is
>>> guaranteed to be invalid. */
>>> #define INVALID_TD_P(pd) __builtin_expect ((pd)->tid <= 0, 0)
>>> +static inline bool
>>> +__pthread_descriptor_valid (struct pthread *pd)
>>> +{
>>> + return atomic_load_relaxed (&pd->joinstate) != THREAD_STATE_EXITED;
>>> +}
>>
>> This does not match the commit message: INVALID_TD_P is still there, but
>> unused. Please also mention __pthread_descriptor_valid in the commit
>> message.
>
> Indeed, I forgot to remove the unused macro. I updated the commit as well:
> Are you ok with the following patch:
>
> From 32d9930fad88af49652a0bed8b390aba476bd9dd Mon Sep 17 00:00:00 2001
> From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> Date: Thu, 11 Dec 2025 17:47:20 -0300
> Subject: [PATCH 4/6] nptl: Remove INVALID_TD_P
>
> And use the new __pthread_descriptor_valid function that checks
> for 'joinstate' to get the thread state instead of 'tid'. The
> joinstate is set by the kernel when the thread exits.
>
> Checked on x86_64-linux-gnu.
This version is okay.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Thanks,
Florian
More information about the Libc-alpha
mailing list