From 5c1482a6363134df4ab049c23168c76a975a0a1e Mon Sep 17 00:00:00 2001 From: "Vicente J. Botet Escriba" Date: Mon, 28 Sep 2015 23:48:20 +0200 Subject: [PATCH] fix bad usage of share_from_this before the instance is ahared :(. --- include/boost/thread/csbl/memory.hpp | 1 + .../boost/thread/csbl/memory/shared_ptr.hpp | 17 +- include/boost/thread/detail/thread.hpp | 4 +- include/boost/thread/future.hpp | 162 +++++++++--------- include/boost/thread/pthread/thread_data.hpp | 7 +- src/pthread/thread.cpp | 2 +- test/Jamfile.v2 | 24 +-- 7 files changed, 114 insertions(+), 103 deletions(-) diff --git a/include/boost/thread/csbl/memory.hpp b/include/boost/thread/csbl/memory.hpp index e076f11a..a201a688 100644 --- a/include/boost/thread/csbl/memory.hpp +++ b/include/boost/thread/csbl/memory.hpp @@ -57,5 +57,6 @@ namespace boost // 20.8.2.4, class template enable_shared_from_this: // 20.8.2.5, shared_ptr atomic access: // 20.8.2.6 hash support +#include #endif // header diff --git a/include/boost/thread/csbl/memory/shared_ptr.hpp b/include/boost/thread/csbl/memory/shared_ptr.hpp index e9a93837..7f791901 100644 --- a/include/boost/thread/csbl/memory/shared_ptr.hpp +++ b/include/boost/thread/csbl/memory/shared_ptr.hpp @@ -11,17 +11,28 @@ #include -#if defined BOOST_NO_CXX11_SMART_PTR +//#if defined BOOST_NO_CXX11_SMART_PTR +#if 1 #include #include +#include namespace boost { + template bool atomic_compare_exchange_strong( shared_ptr * p, shared_ptr * v, shared_ptr w ) + { + return atomic_compare_exchange(p,v,w); + } + namespace csbl { using ::boost::shared_ptr; using ::boost::make_shared; + using ::boost::dynamic_pointer_cast; + using ::boost::enable_shared_from_this; + using ::boost::atomic_load; + using ::boost::atomic_compare_exchange_strong; } } @@ -35,6 +46,10 @@ namespace boost { using std::shared_ptr; using std::make_shared; + using std::dynamic_pointer_cast; + using std::enable_shared_from_this; + using std::atomic_load; + using std::atomic_compare_exchange_strong; } } diff --git a/include/boost/thread/detail/thread.hpp b/include/boost/thread/detail/thread.hpp index 7d7a9da5..64721d20 100644 --- a/include/boost/thread/detail/thread.hpp +++ b/include/boost/thread/detail/thread.hpp @@ -838,7 +838,7 @@ namespace boost void BOOST_THREAD_DECL add_thread_exit_function(thread_exit_function_base*); struct shared_state_base; #if defined(BOOST_THREAD_PLATFORM_WIN32) - inline void make_ready_at_thread_exit(shared_ptr as) + inline void make_ready_at_thread_exit(csbl::shared_ptr as) { detail::thread_data_base* const current_thread_data(detail::get_current_thread_data()); if(current_thread_data) @@ -847,7 +847,7 @@ namespace boost } } #else - void BOOST_THREAD_DECL make_ready_at_thread_exit(shared_ptr as); + void BOOST_THREAD_DECL make_ready_at_thread_exit(csbl::shared_ptr as); #endif } diff --git a/include/boost/thread/future.hpp b/include/boost/thread/future.hpp index 6260a893..ad508a4a 100644 --- a/include/boost/thread/future.hpp +++ b/include/boost/thread/future.hpp @@ -47,12 +47,13 @@ #endif #include #include -#include +//#include #include #include #include #include -#include +//#include +#include #include #include #include @@ -80,6 +81,7 @@ #include #include + #if defined BOOST_THREAD_PROVIDES_FUTURE #define BOOST_THREAD_FUTURE future #else @@ -114,12 +116,12 @@ namespace boost relocker& operator=(relocker const&); }; - struct shared_state_base : enable_shared_from_this + struct shared_state_base : csbl::enable_shared_from_this { typedef std::list waiter_list; typedef waiter_list::iterator notify_when_ready_handle; // This type should be only included conditionally if interruptions are allowed, but is included to maintain the same layout. - typedef shared_ptr continuation_ptr_type; + typedef csbl::shared_ptr continuation_ptr_type; typedef std::vector continuations_type; boost::exception_ptr exception; @@ -484,7 +486,7 @@ namespace boost #if defined BOOST_THREAD_FUTURE_USES_OPTIONAL typedef boost::optional storage_type; #else - typedef boost::csbl::unique_ptr storage_type; + typedef csbl::unique_ptr storage_type; #endif #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES typedef T const& source_reference_type; @@ -829,7 +831,7 @@ namespace boost void init(BOOST_THREAD_FWD_REF(Fp) f) { - shared_ptr that = this->shared_from_this(); + csbl::shared_ptr that = this->shared_from_this(); #ifdef BOOST_THREAD_FUTURE_BLOCKING this->thr_ = thread(&future_async_shared_state::run, that, boost::forward(f)); #else @@ -837,7 +839,7 @@ namespace boost #endif } - static void run(shared_ptr that_, BOOST_THREAD_FWD_REF(Fp) f) + static void run(csbl::shared_ptr that_, BOOST_THREAD_FWD_REF(Fp) f) { future_async_shared_state* that = static_cast(that_.get()); try @@ -863,7 +865,7 @@ namespace boost #endif } - static void run(shared_ptr that_, BOOST_THREAD_FWD_REF(Fp) f) + static void run(csbl::shared_ptr that_, BOOST_THREAD_FWD_REF(Fp) f) { future_async_shared_state* that = static_cast(that_.get()); try @@ -890,7 +892,7 @@ namespace boost #endif } - static void run(shared_ptr that_, BOOST_THREAD_FWD_REF(Fp) f) + static void run(csbl::shared_ptr that_, BOOST_THREAD_FWD_REF(Fp) f) { future_async_shared_state* that = static_cast(that_.get()); try @@ -997,11 +999,11 @@ namespace boost struct registered_waiter; struct registered_waiter { - boost::shared_ptr future_; + csbl::shared_ptr future_; detail::shared_state_base::notify_when_ready_handle handle; count_type index; - registered_waiter(boost::shared_ptr const& a_future, + registered_waiter(csbl::shared_ptr const& a_future, detail::shared_state_base::notify_when_ready_handle handle_, count_type index_): future_(a_future),handle(handle_),index(index_) @@ -1204,7 +1206,7 @@ namespace boost protected: public: - typedef boost::shared_ptr > future_ptr; + typedef csbl::shared_ptr > future_ptr; typedef typename detail::shared_state::move_dest_type move_dest_type; static //BOOST_CONSTEXPR @@ -2110,7 +2112,7 @@ namespace boost template class promise { - typedef boost::shared_ptr > future_ptr; + typedef csbl::shared_ptr > future_ptr; typedef typename detail::shared_state::source_reference_type source_reference_type; typedef typename detail::shared_state::rvalue_source_type rvalue_source_type; @@ -2127,7 +2129,7 @@ namespace boost if(!atomic_load(&future_)) { future_ptr blank; - atomic_compare_exchange(&future_,&blank,future_ptr(new detail::shared_state)); + atomic_compare_exchange_strong(&future_,&blank,future_ptr(new detail::shared_state)); } #include #endif @@ -2332,7 +2334,7 @@ namespace boost template class promise { - typedef boost::shared_ptr > future_ptr; + typedef csbl::shared_ptr > future_ptr; future_ptr future_; bool future_obtained; @@ -2344,7 +2346,7 @@ namespace boost if(!atomic_load(&future_)) { future_ptr blank; - atomic_compare_exchange(&future_,&blank,future_ptr(new detail::shared_state)); + atomic_compare_exchange_strong(&future_,&blank,future_ptr(new detail::shared_state)); } #include #endif @@ -2486,7 +2488,7 @@ namespace boost template <> class promise { - typedef boost::shared_ptr > future_ptr; + typedef csbl::shared_ptr > future_ptr; future_ptr future_; bool future_obtained; @@ -2497,7 +2499,7 @@ namespace boost if(!atomic_load(&future_)) { future_ptr blank; - atomic_compare_exchange(&future_,&blank,future_ptr(new detail::shared_state)); + atomic_compare_exchange_strong(&future_,&blank,future_ptr(new detail::shared_state)); } #endif } @@ -3222,21 +3224,21 @@ namespace boost template class packaged_task { - typedef boost::shared_ptr > task_ptr; - boost::shared_ptr > task; + typedef csbl::shared_ptr > task_ptr; + csbl::shared_ptr > task; #else template class packaged_task { - typedef boost::shared_ptr > task_ptr; - boost::shared_ptr > task; + typedef csbl::shared_ptr > task_ptr; + csbl::shared_ptr > task; #endif #else template class packaged_task { - typedef boost::shared_ptr > task_ptr; - boost::shared_ptr > task; + typedef csbl::shared_ptr > task_ptr; + csbl::shared_ptr > task; #endif bool future_obtained; struct dummy; @@ -3546,7 +3548,7 @@ namespace detail template BOOST_THREAD_FUTURE make_future_deferred_shared_state(BOOST_THREAD_FWD_REF(Fp) f) { - shared_ptr > + csbl::shared_ptr > h(new future_deferred_shared_state(boost::forward(f))); return BOOST_THREAD_FUTURE(h); } @@ -3557,7 +3559,7 @@ namespace detail template BOOST_THREAD_FUTURE make_future_async_shared_state(BOOST_THREAD_FWD_REF(Fp) f) { - shared_ptr > + csbl::shared_ptr > h(new future_async_shared_state()); h->init(boost::forward(f)); return BOOST_THREAD_FUTURE(h); @@ -3707,12 +3709,12 @@ namespace detail { template struct shared_state_nullary_task { - shared_ptr that; + csbl::shared_ptr that; Fp f_; public: - shared_state_nullary_task(shared_ptr st, BOOST_THREAD_FWD_REF(Fp) f) + shared_state_nullary_task(csbl::shared_ptr st, BOOST_THREAD_FWD_REF(Fp) f) : that(st), f_(boost::move(f)) {}; #if ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) @@ -3745,7 +3747,7 @@ namespace detail { } #endif void operator()() { - shared_ptr> that_ = dynamic_pointer_cast>(that); + csbl::shared_ptr> that_ = csbl::dynamic_pointer_cast>(that); if (! that) return; try { that_->mark_finished_with_result(f_()); @@ -3761,10 +3763,10 @@ namespace detail { template struct shared_state_nullary_task { - shared_ptr that; + csbl::shared_ptr that; Fp f_; public: - shared_state_nullary_task(shared_ptr st, BOOST_THREAD_FWD_REF(Fp) f) + shared_state_nullary_task(csbl::shared_ptr st, BOOST_THREAD_FWD_REF(Fp) f) : that(st), f_(boost::move(f)) {}; #if ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) @@ -3796,7 +3798,7 @@ namespace detail { } #endif void operator()() { - shared_ptr> that_ = dynamic_pointer_cast>(that); + csbl::shared_ptr> that_ = csbl::dynamic_pointer_cast>(that); if (! that) return; try { f_(); @@ -3810,10 +3812,10 @@ namespace detail { template struct shared_state_nullary_task { - shared_ptr that; + csbl::shared_ptr that; Fp f_; public: - shared_state_nullary_task(shared_ptr st, BOOST_THREAD_FWD_REF(Fp) f) + shared_state_nullary_task(csbl::shared_ptr st, BOOST_THREAD_FWD_REF(Fp) f) : that(st), f_(boost::move(f)) {} #if ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) @@ -3844,7 +3846,7 @@ namespace detail { } #endif void operator()() { - shared_ptr> that_ = dynamic_pointer_cast>(that); + csbl::shared_ptr> that_ = csbl::dynamic_pointer_cast>(that); if (! that) return; try { that_->mark_finished_with_result(f_()); @@ -3857,17 +3859,15 @@ namespace detail { ///////////////////////// /// future_executor_shared_state_base ///////////////////////// - template + template struct future_executor_shared_state: shared_state { typedef shared_state base_type; protected: public: template - future_executor_shared_state(Executor& ex, BOOST_THREAD_FWD_REF(Fp) f) { + future_executor_shared_state(BOOST_THREAD_FWD_REF(Fp) f) { this->set_executor(); - shared_state_nullary_task t(this->shared_from_this(), boost::forward(f)); - ex.submit(boost::move(t)); } #ifdef BOOST_THREAD_FUTURE_BLOCKING @@ -3886,8 +3886,10 @@ namespace detail { template BOOST_THREAD_FUTURE make_future_executor_shared_state(Executor& ex, BOOST_THREAD_FWD_REF(Fp) f) { - shared_ptr > - h(new future_executor_shared_state(ex, boost::forward(f))); + csbl::shared_ptr > + h(new future_executor_shared_state(boost::forward(f))); + shared_state_nullary_task t(h, boost::forward(f)); + ex.submit(boost::move(t)); return BOOST_THREAD_FUTURE(h); } @@ -4238,7 +4240,7 @@ namespace detail { F parent; Fp continuation; - shared_ptr centinel; + csbl::shared_ptr centinel; public: future_async_continuation_shared_state(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c) @@ -4257,7 +4259,7 @@ namespace detail #endif } - static void run(shared_ptr that_) { + static void run(csbl::shared_ptr that_) { future_async_continuation_shared_state* that = static_cast(that_.get()); try { that->mark_finished_with_result(that->continuation(boost::move(that->parent))); @@ -4275,7 +4277,7 @@ namespace detail { F parent; Fp continuation; - shared_ptr centinel; + csbl::shared_ptr centinel; public: future_async_continuation_shared_state(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c) @@ -4293,7 +4295,7 @@ namespace detail #endif } - static void run(shared_ptr that_) { + static void run(csbl::shared_ptr that_) { future_async_continuation_shared_state* that = static_cast(that_.get()); try { that->continuation(boost::move(that->parent)); @@ -4314,9 +4316,9 @@ namespace detail template struct run_it { - shared_ptr that_; + csbl::shared_ptr that_; - run_it(shared_ptr that) : that_ (that) {} + run_it(csbl::shared_ptr that) : that_ (that) {} void operator()() { FutureExecutorContinuationSharedState* that = static_cast(that_.get()); @@ -4330,7 +4332,7 @@ namespace detail Ex* ex; F parent; Fp continuation; - shared_ptr centinel; + csbl::shared_ptr centinel; public: future_executor_continuation_shared_state(Ex& ex, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c) @@ -4345,7 +4347,7 @@ namespace detail ex->submit(fct); } - static void run(shared_ptr that_) { + static void run(csbl::shared_ptr that_) { future_executor_continuation_shared_state* that = static_cast(that_.get()); try { that->mark_finished_with_result(that->continuation(boost::move(that->parent))); @@ -4370,7 +4372,7 @@ namespace detail Ex* ex; F parent; Fp continuation; - shared_ptr centinel; + csbl::shared_ptr centinel; public: future_executor_continuation_shared_state(Ex& ex, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c) @@ -4385,7 +4387,7 @@ namespace detail ex->submit(fct); } - static void run(shared_ptr that_) { + static void run(csbl::shared_ptr that_) { future_executor_continuation_shared_state* that = static_cast(that_.get()); try { that->continuation(boost::move(that->parent)); @@ -4415,7 +4417,7 @@ namespace detail { F parent; Fp continuation; - shared_ptr centinel; + csbl::shared_ptr centinel; public: shared_future_async_continuation_shared_state(F f, BOOST_THREAD_FWD_REF(Fp) c) @@ -4433,7 +4435,7 @@ namespace detail #endif } - static void run(shared_ptr that_) { + static void run(csbl::shared_ptr that_) { shared_future_async_continuation_shared_state* that = static_cast(that_.get()); try { that->mark_finished_with_result(that->continuation(that->parent)); @@ -4450,7 +4452,7 @@ namespace detail { F parent; Fp continuation; - shared_ptr centinel; + csbl::shared_ptr centinel; public: shared_future_async_continuation_shared_state(F f, BOOST_THREAD_FWD_REF(Fp) c) @@ -4468,7 +4470,7 @@ namespace detail #endif } - static void run(shared_ptr that_) { + static void run(csbl::shared_ptr that_) { shared_future_async_continuation_shared_state* that = static_cast(that_.get()); try { that->continuation(that->parent); @@ -4492,7 +4494,7 @@ namespace detail Ex* ex; F parent; Fp continuation; - shared_ptr centinel; + csbl::shared_ptr centinel; public: shared_future_executor_continuation_shared_state(Ex& ex, F f, BOOST_THREAD_FWD_REF(Fp) c) @@ -4507,7 +4509,7 @@ namespace detail ex->submit(fct); } - static void run(shared_ptr that_) { + static void run(csbl::shared_ptr that_) { shared_future_executor_continuation_shared_state* that = static_cast(that_.get()); try { that->mark_finished_with_result(that->continuation(that->parent)); @@ -4532,7 +4534,7 @@ namespace detail Ex* ex; F parent; Fp continuation; - shared_ptr centinel; + csbl::shared_ptr centinel; public: shared_future_executor_continuation_shared_state(Ex& ex, F f, BOOST_THREAD_FWD_REF(Fp) c) @@ -4546,7 +4548,7 @@ namespace detail ex->submit(fct); } - static void run(shared_ptr that_) { + static void run(csbl::shared_ptr that_) { shared_future_executor_continuation_shared_state* that = static_cast(that_.get()); try { that->continuation(that->parent); @@ -4574,7 +4576,7 @@ namespace detail { F parent; Fp continuation; - shared_ptr centinel; + csbl::shared_ptr centinel; public: future_deferred_continuation_shared_state(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c) @@ -4611,7 +4613,7 @@ namespace detail { F parent; Fp continuation; - shared_ptr centinel; + csbl::shared_ptr centinel; public: future_deferred_continuation_shared_state(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c) @@ -4653,7 +4655,7 @@ namespace detail { F parent; Fp continuation; - shared_ptr centinel; + csbl::shared_ptr centinel; public: shared_future_deferred_continuation_shared_state(F f, BOOST_THREAD_FWD_REF(Fp) c) @@ -4690,7 +4692,7 @@ namespace detail { F parent; Fp continuation; - shared_ptr centinel; + csbl::shared_ptr centinel; public: shared_future_deferred_continuation_shared_state(F f, BOOST_THREAD_FWD_REF(Fp) c) @@ -4730,7 +4732,7 @@ namespace detail make_future_deferred_continuation_shared_state( boost::unique_lock &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c) { - shared_ptr > + csbl::shared_ptr > h(new future_deferred_continuation_shared_state(boost::move(f), boost::forward(c))); #ifdef BOOST_THREAD_FUTURE_BLOCKING lock.lock(); @@ -4750,7 +4752,7 @@ namespace detail make_future_async_continuation_shared_state( boost::unique_lock &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c) { - shared_ptr > + csbl::shared_ptr > h(new future_async_continuation_shared_state(boost::move(f), boost::forward(c))); #ifdef BOOST_THREAD_FUTURE_BLOCKING lock.lock(); @@ -4773,7 +4775,7 @@ namespace detail make_future_executor_continuation_shared_state(Ex& ex, boost::unique_lock &lock, BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_FWD_REF(Fp) c) { - shared_ptr > + csbl::shared_ptr > h(new future_executor_continuation_shared_state(ex, boost::move(f), boost::forward(c))); #ifdef BOOST_THREAD_FUTURE_BLOCKING lock.lock(); @@ -4795,7 +4797,7 @@ namespace detail make_shared_future_deferred_continuation_shared_state( boost::unique_lock &lock, F f, BOOST_THREAD_FWD_REF(Fp) c) { - shared_ptr > + csbl::shared_ptr > h(new shared_future_deferred_continuation_shared_state(f, boost::forward(c))); #ifdef BOOST_THREAD_FUTURE_BLOCKING lock.lock(); @@ -4815,7 +4817,7 @@ namespace detail make_shared_future_async_continuation_shared_state( boost::unique_lock &lock, F f, BOOST_THREAD_FWD_REF(Fp) c) { - shared_ptr > + csbl::shared_ptr > h(new shared_future_async_continuation_shared_state(f, boost::forward(c))); #ifdef BOOST_THREAD_FUTURE_BLOCKING lock.lock(); @@ -4836,7 +4838,7 @@ namespace detail make_shared_future_executor_continuation_shared_state(Ex& ex, boost::unique_lock &lock, F f, BOOST_THREAD_FWD_REF(Fp) c) { - shared_ptr > + csbl::shared_ptr > h(new shared_future_executor_continuation_shared_state(ex, f, boost::forward(c))); #ifdef BOOST_THREAD_FUTURE_BLOCKING lock.lock(); @@ -5257,7 +5259,7 @@ namespace detail template BOOST_THREAD_FUTURE make_future_unwrap_shared_state(boost::unique_lock &lock, BOOST_THREAD_RV_REF(F) f) { - shared_ptr > + csbl::shared_ptr > h(new future_unwrap_shared_state(boost::move(f))); #ifdef BOOST_THREAD_FUTURE_BLOCKING lock.lock(); @@ -5310,7 +5312,7 @@ namespace detail typedef typename F::value_type value_type; vector_type vec_; - static void run(shared_ptr that_) { + static void run(csbl::shared_ptr that_) { future_when_all_vector_shared_state* that = static_cast(that_.get()); try { boost::wait_for_all(that->vec_.begin(), that->vec_.end()); @@ -5380,7 +5382,7 @@ namespace detail typedef typename F::value_type value_type; vector_type vec_; - static void run(shared_ptr that_) + static void run(csbl::shared_ptr that_) { future_when_any_vector_shared_state* that = static_cast(that_.get()); try { @@ -5483,7 +5485,7 @@ namespace detail Tuple tup_; typedef typename make_tuple_indices<1+sizeof...(T)>::type Index; - static void run(shared_ptr that_) { + static void run(csbl::shared_ptr that_) { future_when_all_tuple_shared_state* that = static_cast(that_.get()); try { // TODO make use of apply(that->tup_, boost::detail::wait_for_all_fctor()); @@ -5524,7 +5526,7 @@ namespace detail public: template< typename F, typename ...Fs> future_when_all_tuple_shared_state(values_tag, BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(Fs) ... futures) : - tup_(boost::csbl::make_tuple(boost::forward(f), boost::forward(futures)...)) + tup_(csbl::make_tuple(boost::forward(f), boost::forward(futures)...)) { } @@ -5555,7 +5557,7 @@ namespace detail Tuple tup_; typedef typename make_tuple_indices<1+sizeof...(T)>::type Index; - static void run(shared_ptr that_) + static void run(csbl::shared_ptr that_) { future_when_any_tuple_shared_state* that = static_cast(that_.get()); try { @@ -5597,7 +5599,7 @@ namespace detail future_when_any_tuple_shared_state(values_tag, BOOST_THREAD_FWD_REF(F) f, BOOST_THREAD_FWD_REF(Fs) ... futures ) : - tup_(boost::csbl::make_tuple(boost::forward(f), boost::forward(futures)...)) + tup_(csbl::make_tuple(boost::forward(f), boost::forward(futures)...)) { } @@ -5617,7 +5619,7 @@ namespace detail typedef detail::future_when_all_vector_shared_state factory_type; if (first==last) return make_ready_future(container_type()); - shared_ptr + csbl::shared_ptr h(new factory_type(detail::input_iterator_tag_value, first,last)); h->init(); return BOOST_THREAD_FUTURE(h); @@ -5634,7 +5636,7 @@ namespace detail typedef csbl::tuple::type, typename decay::type...> container_type; typedef detail::future_when_all_tuple_shared_state::type, typename decay::type...> factory_type; - shared_ptr + csbl::shared_ptr h(new factory_type(detail::values_tag_value, boost::forward(f), boost::forward(futures)...)); h->init(); return BOOST_THREAD_FUTURE(h); @@ -5651,7 +5653,7 @@ namespace detail typedef detail::future_when_any_vector_shared_state factory_type; if (first==last) return make_ready_future(container_type()); - shared_ptr + csbl::shared_ptr h(new factory_type(detail::input_iterator_tag_value, first,last)); h->init(); return BOOST_THREAD_FUTURE(h); @@ -5668,7 +5670,7 @@ namespace detail typedef csbl::tuple::type, typename decay::type...> container_type; typedef detail::future_when_any_tuple_shared_state::type, typename decay::type...> factory_type; - shared_ptr + csbl::shared_ptr h(new factory_type(detail::values_tag_value, boost::forward(f), boost::forward(futures)...)); h->init(); return BOOST_THREAD_FUTURE(h); diff --git a/include/boost/thread/pthread/thread_data.hpp b/include/boost/thread/pthread/thread_data.hpp index dc8ba0fb..1f1168ad 100644 --- a/include/boost/thread/pthread/thread_data.hpp +++ b/include/boost/thread/pthread/thread_data.hpp @@ -13,7 +13,8 @@ #include #include -#include +//#include +#include #include #include #ifdef BOOST_THREAD_USES_CHRONO @@ -127,7 +128,7 @@ namespace boost > notify_list_t; notify_list_t notify; - typedef std::vector > async_states_t; + typedef std::vector > async_states_t; async_states_t async_states_; //#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS @@ -162,7 +163,7 @@ namespace boost notify.push_back(std::pair(cv, m)); } - void make_ready_at_thread_exit(shared_ptr as) + void make_ready_at_thread_exit(csbl::shared_ptr as) { async_states_.push_back(as); } diff --git a/src/pthread/thread.cpp b/src/pthread/thread.cpp index 4743d2db..7f540269 100644 --- a/src/pthread/thread.cpp +++ b/src/pthread/thread.cpp @@ -830,7 +830,7 @@ namespace boost } namespace detail { - void BOOST_THREAD_DECL make_ready_at_thread_exit(shared_ptr as) + void BOOST_THREAD_DECL make_ready_at_thread_exit(csbl::shared_ptr as) { detail::thread_data_base* const current_thread_data(detail::get_current_thread_data()); if(current_thread_data) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 209db2d2..30cb4974 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -341,7 +341,7 @@ rule thread-compile ( sources : reqs * : name ) test-suite ts_async : [ thread-run2-noit ./sync/futures/async/async_pass.cpp : async__async_p ] - #[ thread-run2-noit ./sync/futures/async/async_executor_pass.cpp : async__async_executor_p ] + [ thread-run2-noit ./sync/futures/async/async_executor_pass.cpp : async__async_executor_p ] ; #explicit ts_promise ; @@ -808,18 +808,18 @@ rule thread-compile ( sources : reqs * : name ) [ thread-run2 ../example/not_interleaved2.cpp : ex_not_interleaved2 ] [ thread-run2 ../example/thread_pool.cpp : ex_thread_pool ] [ thread-run2 ../example/user_scheduler.cpp : ex_user_scheduler ] - #[ thread-run2 ../example/executor.cpp : ex_executor ] - #[ thread-run2 ../example/generic_executor_ref.cpp : ex_generic_executor_ref ] - #[ thread-run2 ../example/generic_executor.cpp : ex_generic_executor ] + [ thread-run2 ../example/executor.cpp : ex_executor ] + [ thread-run2 ../example/generic_executor_ref.cpp : ex_generic_executor_ref ] + [ thread-run2 ../example/generic_executor.cpp : ex_generic_executor ] [ thread-run2 ../example/generic_serial_executor.cpp : ex_generic_serial_executor ] [ thread-run2 ../example/serial_executor.cpp : ex_serial_executor ] #[ thread-run2 ../example/generic_serial_executor_cont.cpp : ex_generic_serial_executor_cont ] [ thread-run2 ../example/serial_executor_cont.cpp : ex_serial_executor_cont ] [ thread-run2 ../example/future_when_all.cpp : ex_future_when_all ] - #[ thread-run2 ../example/parallel_accumulate.cpp : ex_parallel_accumulate ] - #[ thread-run2 ../example/parallel_quick_sort.cpp : ex_parallel_quick_sort ] + [ thread-run2 ../example/parallel_accumulate.cpp : ex_parallel_accumulate ] + [ thread-run2 ../example/parallel_quick_sort.cpp : ex_parallel_quick_sort ] [ thread-run2 ../example/with_lock_guard.cpp : ex_with_lock_guard ] - #[ thread-run2 ../example/fib_task_region.cpp : ex_fib_task_region ] + [ thread-run2 ../example/fib_task_region.cpp : ex_fib_task_region ] ; #explicit ts_shared_upwards ; @@ -948,7 +948,7 @@ rule thread-compile ( sources : reqs * : name ) #explicit ts_task_region ; test-suite ts_task_region : - #[ thread-run2-noit ./experimental/parallel/v2/task_region_pass.cpp : task_region_p ] + [ thread-run2-noit ./experimental/parallel/v2/task_region_pass.cpp : task_region_p ] ; explicit ts_other ; @@ -962,15 +962,7 @@ rule thread-compile ( sources : reqs * : name ) test-suite ts_ : #[ thread-run test_11256.cpp ] - #[ thread-run2 ../example/executor.cpp : ex_executor2 ] - #[ thread-run2 ../example/generic_executor_ref.cpp : ex_generic_executor_ref2 ] - #[ thread-run2 ../example/generic_executor.cpp : ex_generic_executor2 ] #[ thread-run2 ../example/generic_serial_executor_cont.cpp : ex_generic_serial_executor_cont2 ] - #[ thread-run2-noit ./sync/futures/async/async_executor_pass.cpp : async__async_executor_p2 ] - #[ thread-run2 ../example/fib_task_region.cpp : ex_fib_task_region2 ] - #[ thread-run2-noit ./experimental/parallel/v2/task_region_pass.cpp : task_region_p2 ] - #[ thread-run2 ../example/parallel_quick_sort.cpp : ex_parallel_quick_sort2 ] - #[ thread-run2 ../example/parallel_accumulate.cpp : ex_parallel_accumulate2 ] #[ thread-run test_11256.cpp ] #[ thread-run test_11499.cpp ] #[ thread-run test_11611.cpp ]