Boost C++ Libraries: Ticket #11818: future.then will be blocked if promise is set after the invocation of then https://svn.boost.org/trac10/ticket/11818 <pre class="wiki">int function() { boost::promise&lt;int&gt; promise; boost::future&lt;int&gt; future = promise.get_future(); boost::future&lt;int&gt; result = future.then ( boost::launch::deferred, [](boost::future&lt;int&gt; &amp;&amp; f) { std::cout &lt;&lt; std::this_thread::get_id() &lt;&lt; ": callback" &lt;&lt; std::endl; std::cout &lt;&lt; "The value is: " &lt;&lt; f.get() &lt;&lt; std::endl; return f.get(); } ); // We could not reach here. std::cout &lt;&lt; std::this_thread::get_id() &lt;&lt; ": function" &lt;&lt; std::endl; promise.set_value(0); return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11818 Trac 1.4.3 Xiaoshuang LU <luxiaoshuang@…> Tue, 24 Nov 2015 12:28:15 GMT summary changed https://svn.boost.org/trac10/ticket/11818#comment:1 https://svn.boost.org/trac10/ticket/11818#comment:1 <ul> <li><strong>summary</strong> <span class="trac-field-old">future.then will be blocked if promise is set after then invocation of then</span> → <span class="trac-field-new">future.then will be blocked if promise is set after the invocation of then</span> </li> </ul> Ticket viboes Tue, 24 Nov 2015 17:28:47 GMT owner, status, description changed https://svn.boost.org/trac10/ticket/11818#comment:2 https://svn.boost.org/trac10/ticket/11818#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>description</strong> modified (<a href="/trac10/ticket/11818?action=diff&amp;version=2">diff</a>) </li> </ul> Ticket viboes Tue, 24 Nov 2015 17:44:51 GMT <link>https://svn.boost.org/trac10/ticket/11818#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11818#comment:3</guid> <description> <p> I believe this is a bug. </p> <p> When you launch the continuation with deferred policy, the continuation shouldn't be executed until a call to result.get() is done. </p> <p> Actually the future.then(launch::deferred, f) do a call to future.wait() and so it blocks. </p> <p> I will try to fix it for the next release, but the release is upcoming :( </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Tue, 24 Nov 2015 23:20:08 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/11818#comment:4 https://svn.boost.org/trac10/ticket/11818#comment:4 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.60.0</span> </li> </ul> <p> <a class="ext-link" href="https://github.com/boostorg/thread/commit/674e1304ef216d7a6e1671e317388fcd841cca09"><span class="icon">​</span>https://github.com/boostorg/thread/commit/674e1304ef216d7a6e1671e317388fcd841cca09</a> </p> Ticket viboes Tue, 08 Dec 2015 21:34:03 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11818#comment:5 https://svn.boost.org/trac10/ticket/11818#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket