[PATCH 1/3] Linux: Add the pthread_gettid_np function
Florian Weimer
fweimer@redhat.com
Tue Mar 11 20:53:58 GMT 2025
>> We don't have the full error checking in the proposed implementation,
>> but given that Bionic does not return on an error, I still think your
>> interfaces are reasonably close, and we can reuse the function name.
>
> sgtm. in particular, i like that you clearly call this out as
> undefined behavior in the docs --- i've spent far too much time
> getting various docs fixed to not mislead n00bs into thinking they can
> use functions like this as thread-validity/existence tests.
Thanks. We've seen people doing the probing with pthread_kill, to such
a degree that we have a backwards compatibility kludge specifically for
that. For new programs, we never return ESRCH. If we can't send the
signal because the kernel thread has already exited, freeing the TID, we
still pretend we sent the signal while the kernel thread existed, and
exited before delivering the signal. But we have older programs that
keep sending signals, waiting for pthread_kill to eventually return
ESRCH. 8-(
Thanks,
Florian
More information about the Libc-alpha
mailing list