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) {
75 if constexpr(nothrow_) {
78 return sanisizer::create<std::vector<std::exception_ptr> >(num_tasks);
82#if defined(_OPENMP) && !defined(SUBPAR_NO_OPENMP_SIMPLE)
83#define SUBPAR_USES_OPENMP_SIMPLE 1
87 #pragma omp parallel for num_threads(num_tasks)
88 for (Task_ w = 0; w < num_tasks; ++w) {
89 if constexpr(nothrow_) {
95 errors[w] = std::current_exception();
102#undef SUBPAR_USES_OPENMP_SIMPLE
104 std::vector<std::thread> workers;
105 workers.reserve(sanisizer::cast<
decltype(workers.size())>(num_tasks));
107 for (Task_ w = 0; w < num_tasks; ++w) {
108 if constexpr(nothrow_) {
109 workers.emplace_back(run_task, w);
111 workers.emplace_back([&run_task,&errors](
int w) ->
void {
115 errors[w] = std::current_exception();
121 for (
auto& wrk : workers) {
126 if constexpr(!nothrow_) {
127 for (
const auto& e : errors) {
129 std::rethrow_exception(e);