如何在任务组中等待 Intel TBB 中的单个任务并杀死其他任务?
How to wait for a single task in Intel TBB in a task group and kill others?
在英特尔 TBB 中,我正在尝试:
1.创建一组任务
2. 让他们 运行
3.当其中一个完成时,我从中得到一些结果并杀死其他人。
我该怎么做?我只能看到API等待所有不只是单身...
谢谢。
完成的任务可以将其结果存储在一个已知的地方并用task::self().cancel_group_execution()
取消分组。 wait_for_all()
然后将变得畅通,该线程可以从已知位置加载结果。
https://www.threadingbuildingblocks.org/docs/help/tbb_userguide/Cancellation_Without_An_Exception.html 显示如何使用 cancel_group_execution()
.
在英特尔 TBB 中,我正在尝试: 1.创建一组任务 2. 让他们 运行 3.当其中一个完成时,我从中得到一些结果并杀死其他人。
我该怎么做?我只能看到API等待所有不只是单身...
谢谢。
完成的任务可以将其结果存储在一个已知的地方并用task::self().cancel_group_execution()
取消分组。 wait_for_all()
然后将变得畅通,该线程可以从已知位置加载结果。
https://www.threadingbuildingblocks.org/docs/help/tbb_userguide/Cancellation_Without_An_Exception.html 显示如何使用 cancel_group_execution()
.