| 123 | |
| 124 | template<typename Index, typename Func> |
| 125 | __forceinline void parallel_for_affinity( const Index N, const Func& func, tbb::affinity_partitioner& ap) |
| 126 | { |
| 127 | #if TBB_INTERFACE_VERSION >= 12002 |
| 128 | tbb::task_group_context context; |
| 129 | tbb::parallel_for(Index(0),N,Index(1),[&](Index i) { |
| 130 | func(i); |
| 131 | },ap,context); |
| 132 | if (context.is_group_execution_cancelled()) |
| 133 | throw std::runtime_error("task cancelled"); |
| 134 | #else |
| 135 | tbb::parallel_for(Index(0),N,Index(1),[&](Index i) { |
| 136 | func(i); |
| 137 | },ap); |
| 138 | if (tbb::task::self().is_cancelled()) |
| 139 | throw std::runtime_error("task cancelled"); |
| 140 | #endif |
| 141 | } |
| 142 | |
| 143 | #else |
| 144 |
no test coverage detected