在英特尔TBB中,我试图: 1、创建一组任务 2、让他们跑 当他们中的一个结束时,我从中得到了一些结果并杀死了其他人。
我该怎么做?我可以看到只有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() .
task::self().cancel_group_execution()
wait_for_all()
cancel_group_execution()