60#ifdef SUBPAR_CUSTOM_PARALLELIZE_SIMPLE
61 if constexpr(nothrow_) {
62#ifdef SUBPAR_CUSTOM_PARALLELIZE_SIMPLE_NOTHROW
63 SUBPAR_CUSTOM_PARALLELIZE_SIMPLE_NOTHROW(num_tasks, run_task);
65 SUBPAR_CUSTOM_PARALLELIZE_SIMPLE(num_tasks, run_task);
68 SUBPAR_CUSTOM_PARALLELIZE_SIMPLE(num_tasks, run_task);
74 }
else if (num_tasks == 1) {
81 if constexpr(nothrow_) {
84 return sanisizer::create<std::vector<std::exception_ptr> >(num_tasks);
88#if defined(_OPENMP) && !defined(SUBPAR_NO_OPENMP_SIMPLE)
89#define SUBPAR_USES_OPENMP_SIMPLE 1
93 #pragma omp parallel for num_threads(num_tasks)
94 for (Task_ w = 0; w < num_tasks; ++w) {
95 if constexpr(nothrow_) {
101 errors[w] = std::current_exception();
108#undef SUBPAR_USES_OPENMP_SIMPLE
111 std::vector<std::thread> workers;
112 sanisizer::reserve(workers, num_tasks - 1);
114 for (Task_ w = 1; w < num_tasks; ++w) {
115 if constexpr(nothrow_) {
116 workers.emplace_back(run_task, w);
118 workers.emplace_back([&run_task,&errors](
int w) ->
void {
122 errors[w] = std::current_exception();
129 if constexpr(nothrow_) {
135 errors[0] = std::current_exception();
140 for (
auto& wrk : workers) {
145 if constexpr(!nothrow_) {
146 for (
const auto& e : errors) {
148 std::rethrow_exception(e);