mirror of
https://github.com/boostorg/thread.git
synced 2026-01-22 05:42:37 +00:00
unwrapped future must forward the continuation to the wrapped future. Related to #10964.
This commit is contained in:
@@ -195,7 +195,7 @@ namespace boost
|
||||
}
|
||||
#endif
|
||||
#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION
|
||||
void set_continuation_ptr(continuation_ptr_type continuation, boost::unique_lock<boost::mutex>& lock)
|
||||
virtual void set_continuation_ptr(continuation_ptr_type continuation, boost::unique_lock<boost::mutex>& lock)
|
||||
{
|
||||
continuation_ptr= continuation;
|
||||
if (done) {
|
||||
@@ -4718,6 +4718,15 @@ namespace detail
|
||||
boost::unique_lock<boost::mutex> lk(this->mutex);
|
||||
return parent_value(lk).get();
|
||||
}
|
||||
#if defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION
|
||||
typedef shared_ptr<shared_state_base> continuation_ptr_type;
|
||||
|
||||
virtual void set_continuation_ptr(continuation_ptr_type continuation, boost::unique_lock<boost::mutex>& lock)
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lk(parent.future_->mutex);
|
||||
parent.future_->set_continuation_ptr(continuation, lk);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class F, class Rp>
|
||||
|
||||
@@ -29,6 +29,10 @@ struct TestCallback
|
||||
}
|
||||
};
|
||||
|
||||
void p1()
|
||||
{
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
#if ! defined BOOST_NO_CXX11_DECLTYPE && ! defined BOOST_NO_CXX11_AUTO_DECLARATIONS
|
||||
@@ -62,6 +66,11 @@ int main()
|
||||
TestCallback()).unwrap().then(TestCallback()).get();
|
||||
}
|
||||
std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
|
||||
{
|
||||
boost::future<void> f = boost::async(p1);
|
||||
f.then(
|
||||
TestCallback()).unwrap().then(TestCallback()).get();
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user