From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Make std::thread::_State private
Date: Fri, 13 May 2022 21:02:13 +0100 [thread overview]
Message-ID: <20220513200213.4138699-1-jwakely@redhat.com> (raw)
Tested powerpc64l4-linux, pushed to trunk.
-- >8 --
* include/bits/std_thread.h (thread::_State, thread::_State_ptr):
Declare as private unless _GLIBCXX_THREAD_IMPL is defined.
* src/c++11/thread.cc (_GLIBCXX_THREAD_IMPL): Define.
---
libstdc++-v3/include/bits/std_thread.h | 21 ++++++++++++---------
libstdc++-v3/src/c++11/thread.cc | 1 +
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/libstdc++-v3/include/bits/std_thread.h b/libstdc++-v3/include/bits/std_thread.h
index f67bc114591..d7fc0123564 100644
--- a/libstdc++-v3/include/bits/std_thread.h
+++ b/libstdc++-v3/include/bits/std_thread.h
@@ -79,15 +79,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
public:
#ifdef _GLIBCXX_HAS_GTHREADS
- // Abstract base class for types that wrap arbitrary functors to be
- // invoked in the new thread of execution.
- struct _State
- {
- virtual ~_State();
- virtual void _M_run() = 0;
- };
- using _State_ptr = unique_ptr<_State>;
-
using native_handle_type = __gthread_t;
#else
using native_handle_type = int;
@@ -216,6 +207,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
hardware_concurrency() noexcept;
#ifdef _GLIBCXX_HAS_GTHREADS
+#ifndef _GLIBCXX_THREAD_IMPL
+ private:
+#endif
+ // Abstract base class for types that wrap arbitrary functors to be
+ // invoked in the new thread of execution.
+ struct _State
+ {
+ virtual ~_State();
+ virtual void _M_run() = 0;
+ };
+ using _State_ptr = unique_ptr<_State>;
+
private:
template<typename _Callable>
struct _State_impl : public _State
diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc
index 669fbb045e2..707a4ad415b 100644
--- a/libstdc++-v3/src/c++11/thread.cc
+++ b/libstdc++-v3/src/c++11/thread.cc
@@ -24,6 +24,7 @@
#define _GLIBCXX_THREAD_ABI_COMPAT 1
+#define _GLIBCXX_THREAD_IMPL 1
#include <memory> // include this first so <thread> can use shared_ptr
#include <thread>
#include <system_error>
--
2.34.3
reply other threads:[~2022-05-13 20:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220513200213.4138699-1-jwakely@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@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: 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).