- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
tbb::task_group_context tg; SomeClass someObject; tbb:: parallel_for(tbb::blocked_range<size_t>(0, num, grainSize), someObject, tbb::simple_partitioner(), tg);
I need to reference tg inside the functor definition of SomeClass so that I can cancel
all the threads under some conditons
lass SomeClass { void operator()(const tbb::blocked_range<size_t>& r) const{
if (somthing < 0) tg.cancel_group_execution(); }
I get compiler error : "tg" not declared in this scope.
How do i reference the "tg" that is being passed into the parallel_for loop
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please look at https://oneapi-src.github.io/oneTBB/main/tbb_userguide/Cancellation_Without_An_Exception.html. Does it help?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please look at https://oneapi-src.github.io/oneTBB/main/tbb_userguide/Cancellation_Without_An_Exception.html. Does it help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
![](/skins/images/1FC86CD46823E418D1E2B7B4DC10231C/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page