1 // Copyright (C) 2015 Vicente Botet
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #define BOOST_THREAD_VERSION 4
7 #define BOOST_THREAD_PROVIDES_EXECUTORS
9 #include <boost/thread.hpp>
10 #include <boost/thread/thread_pool.hpp>
15 boost::promise
<void> promise
;
17 return promise
.get_future();
20 auto stepOne(boost::basic_thread_pool
&executor
)
22 auto sendFuture
= createFuture();
23 auto wrappedFuture
= sendFuture
.then(executor
, [](auto f
) mutable {
24 return createFuture();
27 return wrappedFuture
.unwrap();
30 auto stepTwo(boost::basic_thread_pool
&executor
)
32 auto future
= stepOne(executor
);
33 return future
.then(executor
, [](auto f
) {
40 boost::basic_thread_pool executor
{1};
41 stepTwo(executor
).get();