From 62bffed368ac2625ba1a5281fc689a9871e2a76b Mon Sep 17 00:00:00 2001 From: "Vicente J. Botet Escriba" Date: Tue, 3 Mar 2015 08:27:17 +0100 Subject: [PATCH] More fixes to make executor copyable. --- example/executor.cpp | 30 +++++++++++-------- .../thread/executors/basic_thread_pool.hpp | 3 +- .../executors/generic_serial_executor.hpp | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/example/executor.cpp b/example/executor.cpp index b9c91fbf..15c43804 100644 --- a/example/executor.cpp +++ b/example/executor.cpp @@ -111,25 +111,29 @@ int test_executor_adaptor() submit_some( ea2); ea2.underlying_executor().run_queued_closures(); } -#if ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) // std::cout << BOOST_CONTEXTOF << std::endl; -// { -// boost::basic_thread_pool tp; -// boost::generic_serial_executor e1(tp); -// boost::generic_serial_executor e2 = e1; -// } + { + boost::basic_thread_pool tp; + boost::generic_serial_executor e1(tp); + boost::generic_serial_executor e2 = e1; + } + { + boost::basic_thread_pool ea1(4); + boost::generic_serial_executor ea2(ea1); + boost::executor_adaptor < boost::generic_serial_executor > ea3(ea2); + submit_some(ea3); + } // { // boost::basic_thread_pool ea1(4); // boost::executor_adaptor < boost::generic_serial_executor > ea2(ea1); // submit_some(ea2); // } -// { -// boost::basic_thread_pool ea1(4); -// boost::generic_serial_executor ea2(ea1); -// boost::executor_adaptor < boost::generic_serial_executor > ea3(ea2); -// submit_some(ea3); -// } -#endif +// { +// boost::basic_thread_pool ea1(4); +// boost::generic_serial_executor ea2(ea1); +// boost::executor_adaptor < boost::generic_serial_executor > ea3(ea2); +// submit_some(ea3); +// } // std::cout << BOOST_CONTEXTOF << std::endl; { boost::inline_executor e1; diff --git a/include/boost/thread/executors/basic_thread_pool.hpp b/include/boost/thread/executors/basic_thread_pool.hpp index d03a31e0..ab943f3d 100644 --- a/include/boost/thread/executors/basic_thread_pool.hpp +++ b/include/boost/thread/executors/basic_thread_pool.hpp @@ -280,7 +280,8 @@ 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)) + //: pimpl(make_shared(thread_count)) // todo check why this doesn't works with C++03 + : pimpl(new shared_state(thread_count)) { pimpl->init(); } diff --git a/include/boost/thread/executors/generic_serial_executor.hpp b/include/boost/thread/executors/generic_serial_executor.hpp index 283915da..2c4aca07 100644 --- a/include/boost/thread/executors/generic_serial_executor.hpp +++ b/include/boost/thread/executors/generic_serial_executor.hpp @@ -186,7 +186,7 @@ namespace executors generic_serial_executor(Executor& ex, typename boost::disable_if::type, generic_serial_executor>, int* >::type = (int*)0) - //: pimpl(make_shared(ex)) // // todo check why this doesn't works with C++03 + //: pimpl(make_shared(ex)) // todo check why this doesn't works with C++03 : pimpl(new shared_state(ex)) { }