linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
To: enh <enh@google.com>
Cc: "Michael Kerrisk \(man-pages\)" <mtk.manpages@gmail.com>,
	linux-man@vger.kernel.org
Subject: Re: [PATCH] pthread_kill.3: Update to match POSIX.
Date: Tue, 12 Nov 2019 22:52:41 +0100	[thread overview]
Message-ID: <877e44daom.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <CAJgzZoo+oSkwgCZ3CMUdP-t+Y4h4PkvJO-As15kjz0Ad+nx9fA@mail.gmail.com> (enh's message of "Tue, 12 Nov 2019 13:40:54 -0800")

* enh:

> On Tue, Nov 12, 2019 at 1:38 PM Florian Weimer <fw@deneb.enyo.de> wrote:
>>
>> * enh:
>>
>> > POSIX removed ESRCH years ago.
>> >
>> > In resolving http://austingroupbugs.net/view.php?id=1214 it was made
>> > clear that callers can't rely on using signal 0 to test for the
>> > continued existence of a thread. Update the man page to make it clearer
>> > that this doesn't generally work (even if it sometimes seems to).
>> >
>> > See also the long explanation of why this is the case (and how to fix
>> > your code) here:
>> >
>> > https://android.googlesource.com/platform/bionic/+/master/docs/status.md#invalid-handling-targetsdkversion-o
>>
>> Well, if you fix the thread exit race (like musl did, and glibc should
>> as well, see bug 12889), you could get a reliable ESRCH as a side
>> effect.  Pity that POSIX doesn't allow that.
>
> this isn't about the tid stored *in* the object that the pthread_t points to.
>
> like i (briefly) said in the commit message, this is because a
> pthread_t is a pointer, so if you have an old pthread_t that's been
> recycled... boom!

Backing storage for a pthread_t object denoting a joinable thread
cannot be recycled, so that's not the case here.  POSIX mandates
returning success even if the implementation has detected that it must
not send the signal because the thread has already terminated.

  reply	other threads:[~2019-11-12 21:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 20:36 [PATCH] pthread_kill.3: Update to match POSIX enh
2019-11-12 21:38 ` Florian Weimer
2019-11-12 21:40   ` enh
2019-11-12 21:52     ` Florian Weimer [this message]
2019-11-12 22:06       ` enh
2019-11-12 22:11         ` Florian Weimer
2019-11-12 22:22           ` enh
2019-11-12 22:28             ` Florian Weimer
2019-11-13  5:27               ` enh
2019-11-13  5:51                 ` Florian Weimer
2019-11-13  5:59                   ` enh
2019-11-13  6:10                     ` Florian Weimer
2021-11-09 23:00                       ` enh
2021-11-10  7:14                         ` Florian Weimer
2021-11-12  0:01                           ` enh
2021-11-12 13:02                             ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877e44daom.fsf@mid.deneb.enyo.de \
    --to=fw@deneb.enyo.de \
    --cc=enh@google.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).