diff --git a/example/executor.cpp b/example/executor.cpp index f548c066..8770d1fb 100644 --- a/example/executor.cpp +++ b/example/executor.cpp @@ -105,6 +105,9 @@ int test_executor_adaptor() { boost::loop_executor e1; boost::loop_executor e2 = e1; + boost::executor_adaptor < boost::loop_executor > ea2(e2); + submit_some( ea2); + ea2.underlying_executor().run_queued_closures(); } { boost::executor_adaptor < boost::loop_executor > ea2; @@ -129,17 +132,19 @@ int test_executor_adaptor() boost::executor_adaptor < boost::generic_serial_executor > ea3(ea2); submit_some(ea3); } -#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +//#if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) { boost::basic_thread_pool ea1(4); boost::executor_adaptor < boost::generic_serial_executor > ea2(ea1); submit_some(ea2); } -#endif +//#endif // std::cout << BOOST_CONTEXTOF << std::endl; { boost::inline_executor e1; boost::inline_executor e2 = e1; + boost::executor_adaptor < boost::inline_executor > ea2(e2); + submit_some(ea2); } { boost::executor_adaptor < boost::inline_executor > ea1; @@ -150,6 +155,12 @@ int test_executor_adaptor() boost::thread_executor e1; boost::thread_executor e2 = e1; } + { + boost::thread_executor e1; + boost::executor_adaptor < boost::generic_executor > ea2(e1); + submit_some(ea2); + } + { boost::executor_adaptor < boost::thread_executor > ea1; submit_some(ea1); diff --git a/include/boost/thread/executors/basic_thread_pool.hpp b/include/boost/thread/executors/basic_thread_pool.hpp index ab943f3d..afab0795 100644 --- a/include/boost/thread/executors/basic_thread_pool.hpp +++ b/include/boost/thread/executors/basic_thread_pool.hpp @@ -280,8 +280,7 @@ namespace executors * \b Throws: Whatever exception is thrown while initializing the needed resources. */ basic_thread_pool(unsigned const thread_count = thread::hardware_concurrency()+1) - //: pimpl(make_shared(thread_count)) // todo check why this doesn't works with C++03 - : pimpl(new shared_state(thread_count)) + : pimpl(make_shared(thread_count)) { pimpl->init(); } @@ -308,7 +307,7 @@ namespace executors } template basic_thread_pool( unsigned const thread_count, BOOST_THREAD_FWD_REF(AtThreadEntry) at_thread_entry) - : pimpl(make_shared(thread_count, at_thread_entry)) + : pimpl(make_shared(thread_count, boost::forward(at_thread_entry))) { pimpl->init(); } diff --git a/include/boost/thread/executors/generic_executor.hpp b/include/boost/thread/executors/generic_executor.hpp index 31721628..0513371c 100644 --- a/include/boost/thread/executors/generic_executor.hpp +++ b/include/boost/thread/executors/generic_executor.hpp @@ -35,9 +35,12 @@ namespace boost //generic_executor(generic_executor &&) = default; template - generic_executor(Executor& ex) - //: ex(make_shared >(ex)) // todo check why this doesn't works with C++03 - : ex( new executor_adaptor::type>(ex) ) + generic_executor(Executor const& ex + , typename boost::disable_if, + int* >::type = (int*)0 + ) + //: ex(make_shared >(ex)) // todo check why this doesn't work with C++03 + : ex( new executor_adaptor(ex) ) { } diff --git a/include/boost/thread/executors/generic_executor_ref.hpp b/include/boost/thread/executors/generic_executor_ref.hpp index d1df0e93..b2080e01 100644 --- a/include/boost/thread/executors/generic_executor_ref.hpp +++ b/include/boost/thread/executors/generic_executor_ref.hpp @@ -100,7 +100,7 @@ namespace boost template generic_executor_ref(Executor& ex) - //: ex(make_shared::type> >(ex)) // todo check why this doesn't works with C++03 + //: ex(make_shared::type> >(ex)) // todo check why this doesn't work with C++03 : ex( new executor_ref::type>(ex) ) { } diff --git a/include/boost/thread/executors/generic_serial_executor.hpp b/include/boost/thread/executors/generic_serial_executor.hpp index 2c4aca07..efa9077a 100644 --- a/include/boost/thread/executors/generic_serial_executor.hpp +++ b/include/boost/thread/executors/generic_serial_executor.hpp @@ -108,7 +108,7 @@ namespace executors * \b Throws: Whatever exception is thrown while initializing the needed resources. */ template - shared_state(Executor& ex) + shared_state(Executor const& ex) : ex(ex), thr(&shared_state::worker_thread, this) { } @@ -183,11 +183,10 @@ namespace executors * \b Throws: Whatever exception is thrown while initializing the needed resources. */ template - generic_serial_executor(Executor& ex, - typename boost::disable_if::type, generic_serial_executor>, + generic_serial_executor(Executor const& ex + , typename boost::disable_if, int* >::type = (int*)0) - //: pimpl(make_shared(ex)) // todo check why this doesn't works with C++03 - : pimpl(new shared_state(ex)) + : pimpl(make_shared(ex)) { } /** diff --git a/include/boost/thread/executors/generic_serial_executor_cont.hpp b/include/boost/thread/executors/generic_serial_executor_cont.hpp index 938e5308..1c6cf1fe 100644 --- a/include/boost/thread/executors/generic_serial_executor_cont.hpp +++ b/include/boost/thread/executors/generic_serial_executor_cont.hpp @@ -88,7 +88,7 @@ namespace executors * - the continuation can not submit to this serial executor. */ template - shared_state(Executor& ex) + shared_state(Executor const& ex) : ex_(ex), fut_(make_ready_future()), closed_(false) { } @@ -164,12 +164,10 @@ namespace executors * \b Throws: Whatever exception is thrown while initializing the needed resources. */ template - generic_serial_executor_cont(Executor& ex, - typename boost::disable_if::type, generic_serial_executor_cont>, + generic_serial_executor_cont(Executor const& ex + , typename boost::disable_if, int* >::type = (int*)0) - //: pimpl(make_shared(ex)) // todo check why this doesn't works with C++03 - : pimpl(new shared_state(ex)) - + : pimpl(make_shared(ex)) { } /**