diff options
author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-16 17:53:52 +0000 |
---|---|---|
committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-16 17:53:52 +0000 |
commit | 5e190f2ea6a835d97260b87d6b5c3f38f6ff5f10 (patch) | |
tree | d98b3e6ac726f2c526b58974fd31605164c9e7b3 | |
parent | 8e3baf54dbaba3db6f98e14a07c0792c6439cbaa (diff) |
PR libstdc++/65393
* src/c++11/thread.cc (thread::_M_make_thread): Replace shared_ptr
copies with moves.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224530 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libstdc++-v3/ChangeLog | 6 | ||||
-rw-r--r-- | libstdc++-v3/src/c++11/thread.cc | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e124e06be7f..8c9ed9a45b9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2015-06-16 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/65393 + * src/c++11/thread.cc (thread::_M_make_thread): Replace shared_ptr + copies with moves. + 2015-06-12 Jonathan Wakely <jwakely@redhat.com> * include/precompiled/stdc++.h: Include <codecvt> and <shared_mutex>. diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc index 954f2676aa1..906cafa735a 100644 --- a/libstdc++-v3/src/c++11/thread.cc +++ b/libstdc++-v3/src/c++11/thread.cc @@ -92,7 +92,7 @@ namespace std _GLIBCXX_VISIBILITY(default) std::terminate(); } - return 0; + return nullptr; } } @@ -137,18 +137,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __throw_system_error(int(errc::operation_not_permitted)); #endif - _M_start_thread(__b, nullptr); + _M_start_thread(std::move(__b), nullptr); } void thread::_M_start_thread(__shared_base_type __b, void (*)()) { - __b->_M_this_ptr = __b; + auto ptr = __b.get(); + ptr->_M_this_ptr = std::move(__b); int __e = __gthread_create(&_M_id._M_thread, - &execute_native_thread_routine, __b.get()); + &execute_native_thread_routine, ptr); if (__e) { - __b->_M_this_ptr.reset(); + ptr->_M_this_ptr.reset(); __throw_system_error(__e); } } |