Opened 7 years ago

Last modified 7 years ago

#11818 closed Bugs

future.then will be blocked if promise is set after then invocation of then — at Initial Version

Reported by: Xiaoshuang LU <luxiaoshuang@…> Owned by: Anthony Williams
Milestone: Boost 1.60.0 Component: thread
Version: Boost 1.59.0 Severity: Problem
Keywords: Cc:

Description

int function() {

boost::promise<int> promise; boost::future<int> future = promise.get_future();

boost::future<int> result = future.then (

boost::launch::deferred, [](boost::future<int> && f) {

std::cout << std::this_thread::get_id() << ": callback" << std::endl; std::cout << "The value is: " << f.get() << std::endl; return f.get();

}

);

We could not reach here. std::cout << std::this_thread::get_id() << ": function" << std::endl;

promise.set_value(0);

return 0;

}

Change History (0)

Note: See TracTickets for help on using tickets.