linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: enh <enh@google.com>
To: Florian Weimer <fw@deneb.enyo.de>
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 14:22:44 -0800	[thread overview]
Message-ID: <CAJgzZorosDN58Zp6TUDJbzY3fmR-rJeWbELtw_H3nzMyaWondg@mail.gmail.com> (raw)
In-Reply-To: <87woc4bv9c.fsf@mid.deneb.enyo.de>

On Tue, Nov 12, 2019 at 2:11 PM Florian Weimer <fw@deneb.enyo.de> wrote:
>
> * enh:
>
> > On Tue, Nov 12, 2019 at 1:52 PM Florian Weimer <fw@deneb.enyo.de> wrote:
> >>
> >> * 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.
> >
> > who said anything about joinable?
>
> That determines whether the pthread_t object is still valid.

but this is all about *invalid* threads, which obviously can't be
joinable. i'm really not sure what you're trying to say.

> > the cases we've seen in practice are that folks incorrectly believe
> > that pthread_kill(3) with a signal of 0 is a reliable way to test
> > whether a thread is still running.
>
> Right, that's not working according to (future) POSIX.  Which I
> dislike because a correct implementation of pthread_kill has to do all
> the work to support this usage (or something like it; after all, only
> testing for termination gives stable results), and then is forced by
> POSIX to discard the data.

  reply	other threads:[~2019-11-12 22:22 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
2019-11-12 22:06       ` enh
2019-11-12 22:11         ` Florian Weimer
2019-11-12 22:22           ` enh [this message]
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=CAJgzZorosDN58Zp6TUDJbzY3fmR-rJeWbELtw_H3nzMyaWondg@mail.gmail.com \
    --to=enh@google.com \
    --cc=fw@deneb.enyo.de \
    --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).