[PATCH 4/6] nptl: Remove INVALID_TD_P

Florian Weimer fweimer@redhat.com
Thu Dec 18 13:50:14 GMT 2025


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

Thanks,
Florian



More information about the Libc-alpha mailing list