54#ifdef SUBPAR_CUSTOM_PARALLELIZE_SIMPLE
55 if constexpr(nothrow_) {
56#ifdef SUBPAR_CUSTOM_PARALLELIZE_SIMPLE_NOTHROW
57 SUBPAR_CUSTOM_PARALLELIZE_SIMPLE_NOTHROW(num_tasks, run_task);
59 SUBPAR_CUSTOM_PARALLELIZE_SIMPLE(num_tasks, run_task);
62 SUBPAR_CUSTOM_PARALLELIZE_SIMPLE(num_tasks, run_task);
68 }
else if (num_tasks == 1) {
73 auto errors = internal::create_error_vector<nothrow_>(num_tasks);
75#if defined(_OPENMP) && !defined(SUBPAR_NO_OPENMP_SIMPLE)
76#define SUBPAR_USES_OPENMP_SIMPLE 1
80 #pragma omp parallel for num_threads(num_tasks)
81 for (Task_ w = 0; w < num_tasks; ++w) {
82 if constexpr(nothrow_) {
88 errors[w] = std::current_exception();
95#undef SUBPAR_USES_OPENMP_SIMPLE
97 std::vector<std::thread> workers;
98 workers.reserve(num_tasks);
100 for (Task_ w = 0; w < num_tasks; ++w) {
101 if constexpr(nothrow_) {
102 workers.emplace_back(run_task, w);
104 workers.emplace_back([&run_task,&errors](
int w) ->
void {
108 errors[w] = std::current_exception();
114 for (
auto& wrk : workers) {
119 if constexpr(!nothrow_) {
120 for (
const auto& e : errors) {
122 std::rethrow_exception(e);