TBB offers tasks cancelation in its model, so a TBB developper can cancel tasks during runtime.
What I would like to know is the reason behind adding this cancelation model to TBB. What kind of algorithms/applications may use cancelation? Are there any TBB applications source code examples out there?
There are examples of its use in the Intel TBB tutorial document available attheopen source website. It is primarily a performance call, to instruct the scheduler to discard sets of queued tasks once a reason has been provided to abort their execution. There can be a number of reasons to cancel tasks: in response to an exception from the system, perhaps as a means to provide a user interrupt for long duration tasks within an application, or just to terminate an exhaustive search once some thread has found the target but perhaps before all the other threads have finished their search lists. Read about it in the tutorial.