diff options
author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-13 18:40:10 +0000 |
---|---|---|
committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-08-13 18:40:10 +0000 |
commit | 9289ffe290ed7b50dd4e5d44cfcb079caef9084c (patch) | |
tree | c392e014c949123a3926cb7b947751e628c2c887 /libstdc++-v3 | |
parent | 7dab9307f1670e455f9c3f06034c857710c93d5d (diff) | |
download | gcc-9289ffe290ed7b50dd4e5d44cfcb079caef9084c.tar.gz |
PR libstdc++/61841
* include/std/thread (thread::_M_start_thread): Declare new overload.
(thread::thread<_Callable, _Args...>): Call new overload with an
explicit reference to pthread_create.
* src/c++11/thread.cc (thread::_M_start_thread): Add new overload.
* config/abi/pre/gnu.ver: Export new function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213922 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 9 | ||||
-rw-r--r-- | libstdc++-v3/config/abi/pre/gnu.ver | 3 | ||||
-rw-r--r-- | libstdc++-v3/include/std/thread | 11 | ||||
-rw-r--r-- | libstdc++-v3/src/c++11/thread.cc | 6 |
4 files changed, 29 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3b15d2d9263..208c778b7aa 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2014-08-13 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/61841 + * include/std/thread (thread::_M_start_thread): Declare new overload. + (thread::thread<_Callable, _Args...>): Call new overload with an + explicit reference to pthread_create. + * src/c++11/thread.cc (thread::_M_start_thread): Add new overload. + * config/abi/pre/gnu.ver: Export new function. + 2014-08-13 Sylvestre Ledru <sylvestre@debian.org> * include/profile/impl/profiler_hash_func.h: Fix a comment typo diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index ed7a93f646d..41fac71adaf 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -1372,6 +1372,9 @@ GLIBCXX_3.4.21 { # std::regex_error::regex_error(std::regex_constants::error_type) _ZNSt11regex_errorC2ENSt15regex_constants10error_typeE; + # void std::thread::_M_start_thread(__shared_base_type, void(*)()) + _ZNSt6thread15_M_start_threadESt10shared_ptrINS_10_Impl_baseEEPFvvE; + } GLIBCXX_3.4.20; diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread index efcb1018a8b..057634722ee 100644 --- a/libstdc++-v3/include/std/thread +++ b/libstdc++-v3/include/std/thread @@ -132,9 +132,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit thread(_Callable&& __f, _Args&&... __args) { +#ifdef GTHR_ACTIVE_PROXY + // Create a reference to pthread_create, not just the gthr weak symbol + _M_start_thread(_M_make_routine(std::__bind_simple( + std::forward<_Callable>(__f), + std::forward<_Args>(__args)...)), + reinterpret_cast<void(*)()>(&pthread_create)); +#else _M_start_thread(_M_make_routine(std::__bind_simple( std::forward<_Callable>(__f), std::forward<_Args>(__args)...))); +#endif } ~thread() @@ -183,6 +191,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION private: void + _M_start_thread(__shared_base_type, void (*)()); + + void _M_start_thread(__shared_base_type); template<typename _Callable> diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc index 49aacb5a96d..bbcc99c56b8 100644 --- a/libstdc++-v3/src/c++11/thread.cc +++ b/libstdc++-v3/src/c++11/thread.cc @@ -137,6 +137,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __throw_system_error(int(errc::operation_not_permitted)); #endif + _M_start_thread(__b, nullptr); + } + + void + thread::_M_start_thread(__shared_base_type __b, void (*)()) + { __b->_M_this_ptr = __b; int __e = __gthread_create(&_M_id._M_thread, &execute_native_thread_routine, __b.get()); |