Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Tasks Cancellation (What for?)

genie86
Beginner
647 Views
Hello everyone,
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?
Thank you
0 Kudos
2 Replies
robert-reed
Valued Contributor II
647 Views
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.
0 Kudos
genie86
Beginner
647 Views
Thank you Robert for your reply that was helpful.
0 Kudos
Reply