From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 6A7F43986434 for ; Fri, 13 May 2022 20:02:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6A7F43986434 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-339-IyrYMq2wNpGQPPKxY7MchA-1; Fri, 13 May 2022 16:02:15 -0400 X-MC-Unique: IyrYMq2wNpGQPPKxY7MchA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AD17886B8AD; Fri, 13 May 2022 20:02:14 +0000 (UTC) Received: from localhost (unknown [10.33.36.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 727592026D6A; Fri, 13 May 2022 20:02:14 +0000 (UTC) From: Jonathan Wakely 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 Message-Id: <20220513200213.4138699-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2022 20:02:19 -0000 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 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 -- 2.34.3