Community
cancel
Showing results for 
Search instead for 
Did you mean: 
bjoto
Beginner
67 Views

tbb::task cancellation

Hi,

What is the best/recommended way of cancelling a tbb::task after it has been spawned? As far as I can see, this is not possible without waiting for the task execute() to complete.

If not cancellation is supported, what was the design decision for this?

Cheers,
//Bjrn Tpel


0 Kudos
3 Replies
ARCH_R_Intel
Employee
67 Views

Task cancellation was left out of the original design because we didn't have enough experience to guide us on doing it right. Now that we have experience, we're working on task cancellation and exception-safe tasks and have a design that seems towork well for both.

For now, the best way is to have the task poll a shared cache line. My blog http://softwareblogs.intel.com/2007/11/08/have-a-fish-how-break-from-a-parallel-loop-in-tbb/explains how to do this in the context of parallel_for by defining a cancelable_range object that "collapses" when the loop is cancelled.

bjoto
Beginner
67 Views

Interresting! Do you have a time frame when we can expect the cancellation functionality to appear in a developer release?

Thanks for the blog pointer.

Cheers,
//Bjrn
ARCH_R_Intel
Employee
67 Views

End of January 2008 is the current target for puttingcancellation/exception-safe tasks in the developer release.

- Arch

Reply