同步操作将从 Gitee 极速下载/cpp-taskflow 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
// The program demonstrates how to cancel a submitted taskflow// graph and wait until the cancellation completes.#include <taskflow/taskflow.hpp>int main() {tf::Executor executor;tf::Taskflow taskflow("cancel");// We create a taskflow graph of 1000 tasks each of 1 second.// Ideally, the taskflow completes in 1000/P seconds, where P// is the number of workers.for(int i=0; i<1000; i++) {taskflow.emplace([](){std::this_thread::sleep_for(std::chrono::seconds(1));});}// submit the taskflowauto beg = std::chrono::steady_clock::now();tf::Future fu = executor.run(taskflow);// submit a cancel request to cancel all 1000 tasks.fu.cancel();// wait until the cancellation finishesfu.get();auto end = std::chrono::steady_clock::now();// the duration should be much less than 1000 secondsstd::cout << "taskflow completes in "<< std::chrono::duration_cast<std::chrono::milliseconds>(end-beg).count()<< " milliseconds\n";return 0;}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。