Boost C++ Libraries: Ticket #11231: Allow to set continuation future's destructor behavior to non-blocking https://svn.boost.org/trac10/ticket/11231 <p> As <a class="ext-link" href="http://thread.gmane.org/gmane.comp.lib.boost.user/83879"><span class="icon">​</span>discussed on the mailing list</a>: </p> <p> Currently, continuation futures created using <code>future&lt;&gt;::then()</code> with <code>boost::launch::async</code> or an executor block on destruction (until the value is ready). </p> <p> I would like there to be a way to disable this behavior, whether through an additional argument in <code>future&lt;&gt;::then()</code> (much like <code>boost::defer_lock</code> in locks' constructors), a method explicitly setting the non-blocking behavior, or implicitly through a call to <code>future&lt;&gt;::wait_for/until()</code>. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11231 Trac 1.4.3 viboes Fri, 24 Apr 2015 21:42:44 GMT owner, status changed https://svn.boost.org/trac10/ticket/11231#comment:1 https://svn.boost.org/trac10/ticket/11231#comment:1 <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> </ul> Ticket viboes Sat, 17 Oct 2015 22:38:39 GMT milestone changed https://svn.boost.org/trac10/ticket/11231#comment:2 https://svn.boost.org/trac10/ticket/11231#comment:2 <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/88ab663ac58a2a903ee26b47a4eedb57535c4d14"><span class="icon">​</span>https://github.com/boostorg/thread/commit/88ab663ac58a2a903ee26b47a4eedb57535c4d14</a> </p> Ticket viboes Wed, 21 Oct 2015 22:18:28 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11231#comment:3 https://svn.boost.org/trac10/ticket/11231#comment:3 <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> <p> 4321b59c1eedde71da58f592aa4c741a1feff046 </p> Ticket anonymous Tue, 22 Mar 2016 14:20:27 GMT <link>https://svn.boost.org/trac10/ticket/11231#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11231#comment:4</guid> <description> <p> The blocking option seems to be broken. Future destructor doesn't block even if BOOST_THREAD_FUTURE_BLOCKING is defined and the futture was obtained by a call to boost::async() with boost::launch::async, or by calling other_future.then(). </p> <pre class="wiki">int main() { { auto future = boost::async(boost::launch::async, []() { std::this_thread::sleep_for(1s); return 42; }); } //future destructor doesn't block //do stuff... //-&gt; will heppen before the future state is ready } </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 13 Jul 2016 10:49:04 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11231#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11231#comment:5</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/11231#comment:4" title="Comment 4">anonymous</a>: </p> <blockquote class="citation"> <p> The blocking option seems to be broken. Future destructor doesn't block even if BOOST_THREAD_FUTURE_BLOCKING is defined and the futture was obtained by a call to boost::async() with boost::launch::async, or by calling other_future.then(). </p> <pre class="wiki">int main() { { auto future = boost::async(boost::launch::async, []() { std::this_thread::sleep_for(1s); return 42; }); } //future destructor doesn't block //do stuff... //-&gt; will heppen before the future state is ready } </pre></blockquote> <p> The future destructor is never called even though the variable 'future' goes out of scope. See ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/12220" title="#12220: Bugs: Memory leak in future::then() (closed: fixed)">#12220</a> for details. </p> </description> <category>Ticket</category> </item> </channel> </rss>