Wildmeshing Toolkit
Loading...
Searching...
No Matches
parallel_for.hpp
1#pragma once
2
3#include <exception>
4#include <functional>
5#include <mutex>
6
7#include "range.hpp"
8
9namespace wmtk::threading {
10
11// ---------------------------------------------------------------------------
12// parallel_for: replaces tbb::parallel_for.
13// The thread count is an explicit argument: `num_threads >= 0` runs on that many
14// threads, anything else (`num_threads` is negative) falls back to hardware_concurrency().
15// ---------------------------------------------------------------------------
16void parallel_for(
17 const range& range,
18 std::function<void(const threading::range&)>&& func,
19 int num_threads = -1);
20
21} // namespace wmtk::threading