From 65499df5b86d9965ac162c9e5a41fe12842cf89b Mon Sep 17 00:00:00 2001 From: cfairles Date: Thu, 5 Feb 2009 17:47:56 +0000 Subject: [PATCH] 2009-02-05 Chris Fairles Benjamin Kosnik * include/std/thread (__thread_data_base): Nest class in std::thread. (__thread_data): Likewise. (__thread_data_ptr): Nest typedef in std::thread. * src/thread.cc (__thread_proxy): Qualify the above names. * config/abi/pre/gnu.ver: Remove unused exports. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143969 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 ++++++ libstdc++-v3/config/abi/pre/gnu.ver | 3 -- libstdc++-v3/include/std/thread | 55 ++++++++++++++++++------------------- libstdc++-v3/src/thread.cc | 5 ++-- 4 files changed, 39 insertions(+), 33 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b1340c4..341e94d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2009-02-05 Chris Fairles + Benjamin Kosnik + + * include/std/thread (__thread_data_base): Nest class in std::thread. + (__thread_data): Likewise. + (__thread_data_ptr): Nest typedef in std::thread. + * src/thread.cc (__thread_proxy): Qualify the above names. + * config/abi/pre/gnu.ver: Remove unused exports. + 2009-02-04 Benjamin Kosnik * include/bits/unique_ptr.h: Remove private __this_type typedef. diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 7a034db..1754f07 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -897,9 +897,6 @@ GLIBCXX_3.4.11 { _ZNSt22condition_variable_anyD2Ev; # thread - _ZNSt10shared_ptrISt18__thread_data_baseED1Ev; - _ZNSt12bad_weak_ptrD0Ev; - _ZNSt12bad_weak_ptrD1Ev; _ZNSt6thread15_M_start_threadEv; _ZNSt6thread4joinEv; _ZNSt6thread6detachEv; diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread index 79bf290..231d4b3 100644 --- a/libstdc++-v3/include/std/thread +++ b/libstdc++-v3/include/std/thread @@ -53,41 +53,25 @@ namespace std { - class __thread_data_base; - - typedef shared_ptr<__thread_data_base> __thread_data_ptr; - - class __thread_data_base + class thread { public: - __thread_data_base() = default; - virtual ~__thread_data_base() = default; + class __thread_data_base; - virtual void _M_run() = 0; + typedef shared_ptr<__thread_data_base> __thread_data_ptr; - __gthread_t _M_thread_handle; - __thread_data_ptr _M_this_ptr; - }; - - template - class __thread_data : public __thread_data_base + class __thread_data_base { public: - __thread_data(_Callable&& __f) - : _M_func(std::forward<_Callable>(__f)) - { } - - void _M_run() - { _M_func(); } - - private: - _Callable _M_func; + __thread_data_base() = default; + virtual ~__thread_data_base() = default; + + virtual void _M_run() = 0; + + __gthread_t _M_thread_handle; + __thread_data_ptr _M_this_ptr; }; - - /// thread - class thread - { - public: + // types class id; typedef __gthread_t native_handle_type; @@ -153,6 +137,21 @@ namespace std private: template + class __thread_data : public __thread_data_base + { + public: + __thread_data(_Callable&& __f) + : _M_func(std::forward<_Callable>(__f)) + { } + + void _M_run() + { _M_func(); } + + private: + _Callable _M_func; + }; + + template __thread_data_ptr _M_make_thread_data(_Callable&& __f) { diff --git a/libstdc++-v3/src/thread.cc b/libstdc++-v3/src/thread.cc index 58e60cf..e3797e6 100644 --- a/libstdc++-v3/src/thread.cc +++ b/libstdc++-v3/src/thread.cc @@ -40,8 +40,9 @@ namespace std { void* __thread_proxy(void* __p) { - __thread_data_base* __t = static_cast<__thread_data_base*>(__p); - __thread_data_ptr __local_thread_data; + thread::__thread_data_base* __t = + static_cast(__p); + thread::__thread_data_ptr __local_thread_data; __local_thread_data.swap(__t->_M_this_ptr); __try -- 2.7.4