[Boost-bugs] [Boost C++ Libraries] #11818: future.then will be blocked if promise is set after then invocation of then

Subject: [Boost-bugs] [Boost C++ Libraries] #11818: future.then will be blocked if promise is set after then invocation of then
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-11-24 12:27:21


#11818: future.then will be blocked if promise is set after then invocation of then
--------------------------------------------+----------------------
 Reporter: Xiaoshuang LU <luxiaoshuang@…> | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.59.0 | Severity: Problem
 Keywords: |
--------------------------------------------+----------------------
 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;
 }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11818>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC