![]() |
Taskflow
3.2.0-Master-Branch
|
class to access the result of an execution More...
#include <taskflow.hpp>
Public Member Functions | |
Future ()=default | |
default constructor | |
Future (const Future &)=delete | |
disabled copy constructor | |
Future (Future &&)=default | |
default move constructor | |
Future & | operator= (const Future &)=delete |
disabled copy assignment | |
Future & | operator= (Future &&)=default |
default move assignment | |
bool | cancel () |
cancels the execution of the running taskflow associated with this future object | |
Friends | |
class | Executor |
class | Subflow |
class to access the result of an execution
tf::Future is a derived class from std::future that will eventually hold the execution result of a submitted taskflow (tf::Executor::run) or an asynchronous task (tf::Executor::async, tf::Executor::silent_async). In addition to the base methods inherited from std::future, you can call tf::Future::cancel 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.
bool tf::Future< T >::cancel | ( | ) |
cancels the execution of the running taskflow associated with this future object
true
if the execution can be cancelled or false
if the execution has already completedWhen 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.