> any comment from either of the maintainers? > > i think what we currently have on this page is factually incorrect, > and this patch better matches reality. One more data point: As of glibc 2.34, pthread_kill in glibc cannot fail with ESRCH anymore (unless the kernel thread is terminated by a direct system call). And the race that the signal could be sent to the wrong thread is gone. > On Tue, Nov 12, 2019 at 10:10 PM Florian Weimer <fw@xxxxxxxxxxxxx> wrote: >> >> * enh: >> >> > On Tue, Nov 12, 2019 at 9:51 PM Florian Weimer <fw@xxxxxxxxxxxxx> wrote: >> >> >> >> * enh: >> >> >> >> > no, because the C library has two choices when a thread exits: >> >> > >> >> > 1. unmap the thread. >> >> > >> >> > 2. keep the thread around for recycling. >> >> > >> >> > if you choose 1 (optimizing for space, like Android), your dereference >> >> > is illegal. >> >> >> >> This choice is only available for threads in a detached state. For >> >> joinable threads, a conforming implementation cannot immediately >> >> deallocate all data structures on thread termination. Among other >> >> things, it has to store the future return value of pthread_join >> >> somewhere. >> > >> > ah, you're trying to say "signal 0 is potentially usable for a >> > joinable thread that's waiting to be joined"? that's true, but i'm not >> > sure how that's relevant to this patch. that wouldn't be an "invalid >> > thread ID" until it's joined. >> >> Correct. That's POSIX's argument why ESRCH wouldn't be valid to >> return here. It's still a forceful loss of information, and >> particularly annoying since POSIX doesn't specify pthread_tryjoin. >> >> But I'm glad we've brought our discussion to a conclusion. 8-)