diff --git a/example/future_fallback_to.cpp b/example/future_fallback_to.cpp index 6b2e36d7..c2c228c3 100644 --- a/example/future_fallback_to.cpp +++ b/example/future_fallback_to.cpp @@ -6,6 +6,10 @@ #define BOOST_THREAD_VERSION 4 //#define BOOST_THREAD_USES_LOG #define BOOST_THREAD_USES_LOG_THREAD_ID +#include +#ifndef BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_THREAD_NO_CXX11_DECLTYPE_N3276 +#endif #include #include diff --git a/example/future_then.cpp b/example/future_then.cpp index aee16186..fb4f7042 100644 --- a/example/future_then.cpp +++ b/example/future_then.cpp @@ -6,6 +6,10 @@ #define BOOST_THREAD_VERSION 4 //#define BOOST_THREAD_USES_LOG #define BOOST_THREAD_USES_LOG_THREAD_ID +#include +#ifndef BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_THREAD_NO_CXX11_DECLTYPE_N3276 +#endif #include #include @@ -69,7 +73,6 @@ int main() try { BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG; - //boost::future f1 = boost::async(boost::launch::async, &p1); boost::future f1 = boost::async(&p1); BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG; boost::future f2 = f1.then(&p2); @@ -94,7 +97,6 @@ int main() try { BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG; - //boost::shared_future f1 = boost::async(boost::launch::async, &p1).share(); boost::shared_future f1 = boost::async(&p1).share(); BOOST_THREAD_LOG << "" << BOOST_THREAD_END_LOG; boost::future f2 = f1.then(&p2s); diff --git a/example/future_unwrap.cpp b/example/future_unwrap.cpp index 448ee414..3b7b2850 100644 --- a/example/future_unwrap.cpp +++ b/example/future_unwrap.cpp @@ -6,6 +6,10 @@ #define BOOST_THREAD_VERSION 4 //#define BOOST_THREAD_USES_LOG #define BOOST_THREAD_USES_LOG_THREAD_ID +#include +#ifndef BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_THREAD_NO_CXX11_DECLTYPE_N3276 +#endif #include #include diff --git a/example/lambda_future.cpp b/example/lambda_future.cpp index e2212fa8..49a3a18f 100644 --- a/example/lambda_future.cpp +++ b/example/lambda_future.cpp @@ -11,6 +11,10 @@ #define BOOST_THREAD_VERSION 4 //#define BOOST_THREAD_USES_LOG #define BOOST_THREAD_USES_LOG_THREAD_ID +#include +#ifndef BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_THREAD_NO_CXX11_DECLTYPE_N3276 +#endif #include #include diff --git a/example/make_future.cpp b/example/make_future.cpp index 581e2a98..bef89db3 100644 --- a/example/make_future.cpp +++ b/example/make_future.cpp @@ -5,6 +5,11 @@ #define BOOST_THREAD_VERSION 4 +#include +#ifndef BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_THREAD_NO_CXX11_DECLTYPE_N3276 +#endif + #include #include @@ -55,6 +60,11 @@ int main() for (int i=0; i< number_of_tests; i++) try { + { + std::cout << __FILE__ << " "<<__LINE__ << std::endl; + boost::future f = boost::async(boost::launch::async, p1); + std::cout << i << " "<& lock) { if (continuation_ptr) { - continuation_ptr->launch_continuation(lock); - if (! lock.owns_lock()) - lock.lock(); + continuation_ptr_type this_continuation_ptr = continuation_ptr; continuation_ptr.reset(); + this_continuation_ptr->launch_continuation(lock); + //if (! lock.owns_lock()) + // lock.lock(); } } #else @@ -679,13 +680,15 @@ namespace boost virtual move_dest_type get() { - wait(); + boost::unique_lock lock(mutex); + wait_internal(lock); return boost::move(*result); } virtual shared_future_get_result_type get_sh() { - wait(); + boost::unique_lock lock(mutex); + wait_internal(lock); return *result; } @@ -755,13 +758,15 @@ namespace boost virtual T& get() { - wait(); + boost::unique_lock lock(mutex); + wait_internal(lock); return *result; } virtual T& get_sh() { - wait(); + boost::unique_lock lock(mutex); + wait_internal(lock); return *result; } @@ -803,12 +808,14 @@ namespace boost virtual void get() { - this->wait(); + boost::unique_lock lock(mutex); + this->wait_internal(lock); } virtual void get_sh() { - wait(); + boost::unique_lock lock(mutex); + this->wait_internal(lock); } void set_value_at_thread_exit() @@ -4051,9 +4058,9 @@ namespace boost { } - void launch_continuation(boost::unique_lock& lock) + void launch_continuation(boost::unique_lock& ) { - lock.unlock(); + //lock.unlock(); this->thr_ = thread(&future_async_continuation_shared_state::run, this); } @@ -4095,9 +4102,9 @@ namespace boost { } - void launch_continuation(boost::unique_lock& lk) + void launch_continuation(boost::unique_lock& ) { - lk.unlock(); + //lk.unlock(); this->thr_ = thread(&future_async_continuation_shared_state::run, this); }