public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] link pthread_join from std::thread ctor Date: Fri, 3 Mar 2023 05:23:50 +0000 (GMT) [thread overview] Message-ID: <20230303052350.D7C28385841D@sourceware.org> (raw) https://gcc.gnu.org/g:45fd40a3a15f083ea13e515e8b6ab62189736df8 commit 45fd40a3a15f083ea13e515e8b6ab62189736df8 Author: Alexandre Oliva <oliva@adacore.com> Date: Fri Mar 3 02:14:53 2023 -0300 link pthread_join from std::thread ctor Like pthread_create, pthread_join may fail to be statically linked in absent strong uses, so add to user code strong references to both when std::thread objects are created. for libstdc++-v3/ChangeLog * include/bits/std_thread.h (std::thread ctor): Add strong reference to pthread_join. * testsuite/30_threads/jthread/95989.cc: Drop extraneous join call. Change-Id: I6c40875f7f7c2c08278f950f23e3b7163dd71c5c TN: W127-055 Diff: --- libstdc++-v3/include/bits/std_thread.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libstdc++-v3/include/bits/std_thread.h b/libstdc++-v3/include/bits/std_thread.h index adbd3928ff7..a504a0b48ed 100644 --- a/libstdc++-v3/include/bits/std_thread.h +++ b/libstdc++-v3/include/bits/std_thread.h @@ -145,6 +145,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #ifdef GTHR_ACTIVE_PROXY // Create a reference to pthread_create, not just the gthr weak symbol. auto __depend = reinterpret_cast<void(*)()>(&pthread_create); + static auto __attribute__((__unused__)) __depend_join = &pthread_join; #else auto __depend = nullptr; #endif
next reply other threads:[~2023-03-03 5:23 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-03 5:23 Alexandre Oliva [this message] 2023-03-03 12:37 Alexandre Oliva 2023-03-03 12:39 Alexandre Oliva 2023-03-03 13:11 Alexandre Oliva 2023-03-03 14:40 Alexandre Oliva 2023-03-03 14:42 Alexandre Oliva 2023-03-03 14:45 Alexandre Oliva 2023-03-03 14:57 Alexandre Oliva 2023-03-03 14:59 Alexandre Oliva 2023-03-03 15:01 Alexandre Oliva 2023-03-03 15:04 Alexandre Oliva 2023-03-03 15:05 Alexandre Oliva 2023-03-03 17:36 Alexandre Oliva 2023-03-03 18:47 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=20230303052350.D7C28385841D@sourceware.org \ --to=aoliva@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /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: linkBe 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).