From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 6646B3982428; Fri, 13 May 2022 20:00:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6646B3982428 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-453] libstdc++: Make std::thread::_State private X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 8659bcd6b7e692a9a516cd57bb19303a2efe78ba X-Git-Newrev: 7f40ac326a1f347a826636bc392a4db185b78b95 Message-Id: <20220513200054.6646B3982428@sourceware.org> Date: Fri, 13 May 2022 20:00:54 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2022 20:00:54 -0000 https://gcc.gnu.org/g:7f40ac326a1f347a826636bc392a4db185b78b95 commit r13-453-g7f40ac326a1f347a826636bc392a4db185b78b95 Author: Jonathan Wakely Date: Thu May 12 20:46:55 2022 +0100 libstdc++: Make std::thread::_State private * 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. Diff: --- 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 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 // include this first so can use shared_ptr #include #include