int p2(boost::future<int>& f) { BOOST_THREAD_LOG << "p2 <" << &f << BOOST_THREAD_END_LOG; BOOST_TEST(f.valid()); int i = f.get(); boost::this_thread::sleep_for(boost::chrono::milliseconds(500)); BOOST_THREAD_LOG << "p2 <" << &f << BOOST_THREAD_END_LOG; return 2 * i; }
void p3(boost::future<int> f) { assert(f.is_ready()); BOOST_THREAD_LOG << "p3 <" << &f << BOOST_THREAD_END_LOG; BOOST_TEST(f.valid()); int i = f.get(); boost::this_thread::sleep_for(boost::chrono::milliseconds(500)); BOOST_THREAD_LOG << "p3 <" << &f << " " <<i << BOOST_THREAD_END_LOG; return; }