diff options
Diffstat (limited to 'boost/thread/detail')
-rw-r--r-- | boost/thread/detail/invoker.hpp | 36 | ||||
-rw-r--r-- | boost/thread/detail/move.hpp | 19 | ||||
-rw-r--r-- | boost/thread/detail/nullary_function.hpp | 2 | ||||
-rw-r--r-- | boost/thread/detail/thread.hpp | 7 | ||||
-rw-r--r-- | boost/thread/detail/thread_group.hpp | 3 |
5 files changed, 48 insertions, 19 deletions
diff --git a/boost/thread/detail/invoker.hpp b/boost/thread/detail/invoker.hpp index 7ab3b33990..9f38e9798d 100644 --- a/boost/thread/detail/invoker.hpp +++ b/boost/thread/detail/invoker.hpp @@ -72,13 +72,21 @@ namespace boost BOOST_SYMBOL_VISIBLE invoker& operator=(BOOST_THREAD_RV_REF(invoker) f) { - f_ = boost::move(BOOST_THREAD_RV(f).f_); + if (this != &f) + { + f_ = boost::move(BOOST_THREAD_RV(f).f_); + } + return *this; } BOOST_SYMBOL_VISIBLE invoker& operator=( BOOST_THREAD_COPY_ASSIGN_REF(invoker) f) { - f_ = f.f_; + if (this != &f) + { + f_ = f.f_; + } + return *this; } result_type operator()() @@ -91,7 +99,7 @@ namespace boost result_type execute(tuple_indices<Indices...>) { - return invoke(boost::move(csbl::get<0>(f_)), boost::move(csbl::get<Indices>(f_))...); + return detail::invoke(boost::move(csbl::get<0>(f_)), boost::move(csbl::get<Indices>(f_))...); } }; @@ -128,7 +136,7 @@ namespace boost result_type execute(tuple_indices<Indices...>) { - return invoke<R>(boost::move(csbl::get<0>(f_)), boost::move(csbl::get<Indices>(f_))...); + return detail::invoke<R>(boost::move(csbl::get<0>(f_)), boost::move(csbl::get<Indices>(f_))...); } }; //BOOST_THREAD_DCL_MOVABLE_BEG(X) invoker<Fp> BOOST_THREAD_DCL_MOVABLE_END @@ -182,7 +190,7 @@ namespace boost {} \ \ result_type operator()() { \ - return invoke(boost::move(fp_) \ + return detail::invoke(boost::move(fp_) \ BOOST_PP_REPEAT(n, BOOST_THREAD_MOVE_DCL, ~) \ ); \ } \ @@ -307,7 +315,7 @@ namespace boost result_type operator()() { - return invoke(boost::move(fp_) + return detail::invoke(boost::move(fp_) , boost::move(v0_) , boost::move(v1_) , boost::move(v2_) @@ -373,7 +381,7 @@ namespace boost result_type operator()() { - return invoke(boost::move(fp_) + return detail::invoke(boost::move(fp_) , boost::move(v0_) , boost::move(v1_) , boost::move(v2_) @@ -434,7 +442,7 @@ namespace boost result_type operator()() { - return invoke(boost::move(fp_) + return detail::invoke(boost::move(fp_) , boost::move(v0_) , boost::move(v1_) , boost::move(v2_) @@ -490,7 +498,7 @@ namespace boost result_type operator()() { - return invoke(boost::move(fp_) + return detail::invoke(boost::move(fp_) , boost::move(v0_) , boost::move(v1_) , boost::move(v2_) @@ -541,7 +549,7 @@ namespace boost result_type operator()() { - return invoke(boost::move(fp_) + return detail::invoke(boost::move(fp_) , boost::move(v0_) , boost::move(v1_) , boost::move(v2_) @@ -587,7 +595,7 @@ namespace boost result_type operator()() { - return invoke(boost::move(fp_) + return detail::invoke(boost::move(fp_) , boost::move(v0_) , boost::move(v1_) , boost::move(v2_) @@ -628,7 +636,7 @@ namespace boost result_type operator()() { - return invoke(boost::move(fp_) + return detail::invoke(boost::move(fp_) , boost::move(v0_) , boost::move(v1_) , boost::move(v2_) @@ -664,7 +672,7 @@ namespace boost result_type operator()() { - return invoke(boost::move(fp_) + return detail::invoke(boost::move(fp_) , boost::move(v0_) , boost::move(v1_) ); @@ -695,7 +703,7 @@ namespace boost result_type operator()() { - return invoke(boost::move(fp_) + return detail::invoke(boost::move(fp_) , boost::move(v0_) ); } diff --git a/boost/thread/detail/move.hpp b/boost/thread/detail/move.hpp index 611557093e..26e4f9dc6d 100644 --- a/boost/thread/detail/move.hpp +++ b/boost/thread/detail/move.hpp @@ -94,6 +94,11 @@ namespace boost template <typename T> \ struct enable_move_utility_emulation_dummy_specialization< +#define BOOST_THREAD_DCL_MOVABLE_BEG2(T1, T2) \ + namespace detail { \ + template <typename T1, typename T2> \ + struct enable_move_utility_emulation_dummy_specialization< + #define BOOST_THREAD_DCL_MOVABLE_END > \ : integral_constant<bool, false> \ {}; \ @@ -115,6 +120,11 @@ namespace boost template <typename T> \ struct enable_move_utility_emulation_dummy_specialization< +#define BOOST_THREAD_DCL_MOVABLE_BEG2(T1, T2) \ + namespace detail { \ + template <typename T1, typename T2> \ + struct enable_move_utility_emulation_dummy_specialization< + #define BOOST_THREAD_DCL_MOVABLE_END > \ : integral_constant<bool, false> \ {}; \ @@ -136,6 +146,11 @@ namespace boost template <typename T> \ struct enable_move_utility_emulation_dummy_specialization< +#define BOOST_THREAD_DCL_MOVABLE_BEG2(T1, T2) \ + namespace detail { \ + template <typename T1, typename T2> \ + struct enable_move_utility_emulation_dummy_specialization< + #define BOOST_THREAD_DCL_MOVABLE_END > \ : integral_constant<bool, false> \ {}; \ @@ -161,6 +176,10 @@ struct enable_move_utility_emulation< TYPE > \ template <typename T> \ struct enable_move_utility_emulation< +#define BOOST_THREAD_DCL_MOVABLE_BEG2(T1, T2) \ +template <typename T1, typename T2> \ +struct enable_move_utility_emulation< + #define BOOST_THREAD_DCL_MOVABLE_END > \ { \ static const bool value = false; \ diff --git a/boost/thread/detail/nullary_function.hpp b/boost/thread/detail/nullary_function.hpp index a0e9fd456a..b3989cf682 100644 --- a/boost/thread/detail/nullary_function.hpp +++ b/boost/thread/detail/nullary_function.hpp @@ -228,7 +228,7 @@ namespace boost }; } - //BOOST_THREAD_DCL_MOVABLE_BEG(F) detail::nullary_function<F> BOOST_THREAD_DCL_MOVABLE_END + BOOST_THREAD_DCL_MOVABLE_BEG(F) detail::nullary_function<F> BOOST_THREAD_DCL_MOVABLE_END } #endif // header diff --git a/boost/thread/detail/thread.hpp b/boost/thread/detail/thread.hpp index b80eacfa1b..9e7e8b8f5e 100644 --- a/boost/thread/detail/thread.hpp +++ b/boost/thread/detail/thread.hpp @@ -72,7 +72,7 @@ namespace boost void run2(tuple_indices<Indices...>) { - invoke(std::move(std::get<0>(fp)), std::move(std::get<Indices>(fp))...); + detail::invoke(std::move(std::get<0>(fp)), std::move(std::get<Indices>(fp))...); } void run() { @@ -173,7 +173,6 @@ namespace boost private: bool start_thread_noexcept(); bool start_thread_noexcept(const attributes& attr); - //public: void start_thread() { if (!start_thread_noexcept()) @@ -355,6 +354,8 @@ namespace boost #if defined BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE if (joinable()) std::terminate(); +#else + detach(); #endif thread_info=BOOST_THREAD_RV(other).thread_info; BOOST_THREAD_RV(other).thread_info.reset(); @@ -485,9 +486,9 @@ namespace boost bool try_join_until(const chrono::time_point<Clock, Duration>& t) { using namespace chrono; - system_clock::time_point s_now = system_clock::now(); bool joined= false; do { + system_clock::time_point s_now = system_clock::now(); typename Clock::duration d = ceil<nanoseconds>(t-Clock::now()); if (d <= Clock::duration::zero()) return false; // in case the Clock::time_point t is already reached joined = try_join_until(s_now + d); diff --git a/boost/thread/detail/thread_group.hpp b/boost/thread/detail/thread_group.hpp index 69ce991e78..4105c73468 100644 --- a/boost/thread/detail/thread_group.hpp +++ b/boost/thread/detail/thread_group.hpp @@ -6,6 +6,7 @@ // (C) Copyright 2007-9 Anthony Williams #include <list> +#include <boost/thread/csbl/memory/unique_ptr.hpp> #include <boost/thread/shared_mutex.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/lock_guard.hpp> @@ -75,7 +76,7 @@ namespace boost thread* create_thread(F threadfunc) { boost::lock_guard<shared_mutex> guard(m); - std::auto_ptr<thread> new_thread(new thread(threadfunc)); + boost::csbl::unique_ptr<thread> new_thread(new thread(threadfunc)); threads.push_back(new_thread.get()); return new_thread.release(); } |