61#ifdef SUBPAR_CUSTOM_PARALLELIZE_SIMPLE
62 if constexpr(nothrow_) {
63#ifdef SUBPAR_CUSTOM_PARALLELIZE_SIMPLE_NOTHROW
64 SUBPAR_CUSTOM_PARALLELIZE_SIMPLE_NOTHROW(num_tasks, run_task);
66 SUBPAR_CUSTOM_PARALLELIZE_SIMPLE(num_tasks, run_task);
69 SUBPAR_CUSTOM_PARALLELIZE_SIMPLE(num_tasks, run_task);
75 }
else if (num_tasks == 1) {
82 if constexpr(nothrow_) {
85 return sanisizer::create<std::vector<std::exception_ptr> >(num_tasks);
89#if defined(_OPENMP) && !defined(SUBPAR_NO_OPENMP_SIMPLE)
90#define SUBPAR_USES_OPENMP_SIMPLE 1
94 #pragma omp parallel for num_threads(num_tasks)
95 for (Task_ w = 0; w < num_tasks; ++w) {
96 if constexpr(nothrow_) {
102 errors[w] = std::current_exception();
109#undef SUBPAR_USES_OPENMP_SIMPLE
112 std::vector<std::thread> workers;
113 sanisizer::reserve(workers, num_tasks - 1);
115 for (Task_ w = 1; w < num_tasks; ++w) {
116 if constexpr(nothrow_) {
117 workers.emplace_back(run_task, w);
119 workers.emplace_back([&run_task,&errors](
int w) ->
void {
123 errors[w] = std::current_exception();
130 if constexpr(nothrow_) {
136 errors[0] = std::current_exception();
141 for (
auto& wrk : workers) {
146 if constexpr(!nothrow_) {
147 for (
const auto& e : errors) {
149 std::rethrow_exception(e);