From 6d7be3beb747073115344e2f7594b1055096ddcf Mon Sep 17 00:00:00 2001 From: Fabio Pellacini Date: Tue, 30 Jan 2024 08:50:41 +0100 Subject: [PATCH] Cleanup --- libs/yocto/yocto_bvh.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/libs/yocto/yocto_bvh.cpp b/libs/yocto/yocto_bvh.cpp index c06d95e84..8e77c6b89 100644 --- a/libs/yocto/yocto_bvh.cpp +++ b/libs/yocto/yocto_bvh.cpp @@ -51,10 +51,7 @@ namespace yocto { // using directives using std::array; -using std::atomic; using std::pair; -using std::string; -using namespace std::string_literals; // consts inline const auto uint_max = std::numeric_limits::max(); @@ -93,33 +90,6 @@ inline void parallel_for(T num, Func&& func) { for (auto& f : futures) f.get(); } -// Simple parallel for used since our target platforms do not yet support -// parallel algorithms. `Func` takes the two integer indices. -template -inline void parallel_for_batch(vec2i num, Func&& func) { - auto futures = vector>{}; - auto nthreads = std::thread::hardware_concurrency(); - std::atomic next_idx(0); - std::atomic has_error(false); - for (auto thread_id = 0; thread_id < (int)nthreads; thread_id++) { - futures.emplace_back( - std::async(std::launch::async, [&func, &next_idx, &has_error, num]() { - try { - while (true) { - auto j = next_idx.fetch_add(1); - if (j >= num[1]) break; - if (has_error) break; - for (auto i = 0; i < num[0]; i++) func(vec2i{i, j}); - } - } catch (...) { - has_error = true; - throw; - } - })); - } - for (auto& f : futures) f.get(); -} - } // namespace yocto // -----------------------------------------------------------------------------