From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Alexandre Oliva <oliva@adacore.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
"libstdc++" <libstdc++@gcc.gnu.org>,
Bernd Edlinger <bernd.edlinger@hotmail.de>
Subject: Re: [libstdc++] Use __gthread_join in jthread/95989
Date: Fri, 17 Feb 2023 10:58:47 +0000 [thread overview]
Message-ID: <CAH6eHdS94kvLApbEtzrDhCEyS7ca_8FGZ60HG5AV-E15cXe0Kg@mail.gmail.com> (raw)
In-Reply-To: <oredqou760.fsf@lxoliva.fsfla.org>
[-- Attachment #1: Type: text/plain, Size: 2057 bytes --]
On Fri, 17 Feb 2023, 06:40 Alexandre Oliva via Libstdc++, <
libstdc++@gcc.gnu.org> wrote:
>
> Ref: https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570617.html
>
> Bernd Edlinger <bernd.edlinger@hotmail.de> reported that the 95989.cc
> test fails without pthread_join at the end of main,
Yes, but that doesn't mean we want to do that.
but pthread_join
> is no good for a test that doesn't require pthreads.
>
> This patch adds a __gthread_join call instead.
>
> Regstrapped on x86_64-linux-gnu.
> Tested on arm-vxworks7 (gcc-12) and arm-eabi (trunk). Ok to install?
>
Nope, the test is correct, if it needs that there's a bug somewhere else.
Papering over it in the test doesn't help.
Each of test01, test02, and test03 creates a thread, joins it, and returns,
which needs to work with no additional code. The change happens to "work"
because it causes a non-weak reference to pthread_join, which otherwise
doesn't get linked in from libpthread.a on ubuntu.
The proper fix is to ensure the program has a non-weak reference to
pthread_join without extra help (or use a recent glibc where it always
works).
> for libstdc++-v3/ChangeLog
>
> * testsuite/30_threads/jthread/95989.cc (main): Call
> __gthread_join at the end.
> ---
> libstdc++-v3/testsuite/30_threads/jthread/95989.cc | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/libstdc++-v3/testsuite/30_threads/jthread/95989.cc
> b/libstdc++-v3/testsuite/30_threads/jthread/95989.cc
> index e98836d094531..407b52748438c 100644
> --- a/libstdc++-v3/testsuite/30_threads/jthread/95989.cc
> +++ b/libstdc++-v3/testsuite/30_threads/jthread/95989.cc
> @@ -52,4 +52,5 @@ main()
> test01();
> test02();
> test03();
> + __gthread_join(0, NULL);
> }
>
> --
> Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/
> Free Software Activist GNU Toolchain Engineer
> Disinformation flourishes because many people care deeply about injustice
> but very few check the facts. Ask me about <https://stallmansupport.org>
>
next prev parent reply other threads:[~2023-02-17 10:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-17 6:39 Alexandre Oliva
2023-02-17 10:58 ` Jonathan Wakely [this message]
2023-03-03 8:18 ` Alexandre Oliva
2023-03-03 9:33 ` Jonathan Wakely
2023-03-03 9:48 ` Jonathan Wakely
2023-03-03 17:46 ` Alexandre Oliva
2023-03-03 18:12 ` Jonathan Wakely
2023-03-03 18:14 ` Jonathan Wakely
2023-03-03 19:55 ` Alexandre Oliva
2023-03-03 20:15 ` Florian Weimer
2023-03-03 20:36 ` Alexandre Oliva
2023-03-03 20:57 ` Alexandre Oliva
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=CAH6eHdS94kvLApbEtzrDhCEyS7ca_8FGZ60HG5AV-E15cXe0Kg@mail.gmail.com \
--to=jwakely.gcc@gmail.com \
--cc=bernd.edlinger@hotmail.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
--cc=oliva@adacore.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 read-only IMAP folder(s) and NNTP newsgroup(s).