52#ifdef SUBPAR_CUSTOM_PARALLELIZE_SIMPLE
53 if constexpr(nothrow_) {
54#ifdef SUBPAR_CUSTOM_PARALLELIZE_SIMPLE_NOTHROW
55 SUBPAR_CUSTOM_PARALLELIZE_SIMPLE_NOTHROW(num_tasks, run_task);
57 SUBPAR_CUSTOM_PARALLELIZE_SIMPLE(num_tasks, run_task);
60 SUBPAR_CUSTOM_PARALLELIZE_SIMPLE(num_tasks, run_task);
66 }
else if (num_tasks == 1) {
72 typename std::conditional<nothrow_, int, std::vector<std::exception_ptr> >::type errors(num_tasks);
74#if defined(_OPENMP) && !defined(SUBPAR_NO_OPENMP_SIMPLE)
75#define SUBPAR_USES_OPENMP_SIMPLE 1
79 #pragma omp parallel for num_threads(num_tasks)
80 for (Task_ w = 0; w < num_tasks; ++w) {
81 if constexpr(nothrow_) {
87 errors[w] = std::current_exception();
94#undef SUBPAR_USES_OPENMP_SIMPLE
96 std::vector<std::thread> workers;
97 workers.reserve(num_tasks);
99 for (Task_ w = 0; w < num_tasks; ++w) {
100 if constexpr(nothrow_) {
101 workers.emplace_back(run_task, w);
103 workers.emplace_back([&run_task,&errors](
int w) ->
void {
107 errors[w] = std::current_exception();
113 for (
auto& wrk : workers) {
118 if constexpr(!nothrow_) {
119 for (
const auto& e : errors) {
121 std::rethrow_exception(e);