<p><ahref="classtf_1_1Future.html" class="m-doc">tf::<wbr/>Future</a> is a derived class from <ahref="http://en.cppreference.com/w/cpp/thread/future.html" class="m-doc-external">std::<wbr/>future</a> that will eventually hold the execution result of a submitted taskflow (<ahref="classtf_1_1Executor.html#a519777f5783981d534e9e53b99712069" class="m-doc">tf::<wbr/>Executor::<wbr/>run</a>) In addition to the base methods inherited from <ahref="http://en.cppreference.com/w/cpp/thread/future.html" class="m-doc-external">std::<wbr/>future</a>, you can call <ahref="#a3bf5f104864ab2590b6409712d3a469b" class="m-doc">tf::<wbr/>Future::<wbr/>cancel</a> to cancel the execution of the running taskflow associated with this future object. The following example cancels a submission of a taskflow that contains 1000 tasks each running one second.</p><preclass="m-code"><spanclass="n">tf</span><spanclass="o">::</span><spanclass="n">Executor</span><spanclass="w"></span><spanclass="n">executor</span><spanclass="p">;</span>
<p>cancels the execution of the running taskflow associated with this future object</p>
<tableclass="m-table m-fullwidth m-flat">
<tfoot>
<tr>
<thstyle="width: 1%">Returns</th>
<td><code>true</code> if the execution can be cancelled or <code>false</code> if the execution has already completed</td>
</tr>
</tfoot>
</table>
<p>When you request a cancellation, the executor will stop scheduling any tasks onwards. Tasks that are already running will continue to finish (non-preemptive). You can call tf::Future::wait to wait for the cancellation to complete.</p>
</div></section>
</section>
</div>
</div>
</div>
</article></main>
<divclass="m-doc-search" id="search">
<ahref="#!" onclick="return hideSearch()"></a>
<divclass="m-container">
<divclass="m-row">
<divclass="m-col-m-8 m-push-m-2">
<divclass="m-doc-search-header m-text m-small">
<div><spanclass="m-label m-default">Tab</span> / <spanclass="m-label m-default">T</span> to search, <spanclass="m-label m-default">Esc</span> to close</div>