diff --git a/src/Mod/Mesh/App/Core/Builder.cpp b/src/Mod/Mesh/App/Core/Builder.cpp index f2e312c638..6da208df60 100644 --- a/src/Mod/Mesh/App/Core/Builder.cpp +++ b/src/Mod/Mesh/App/Core/Builder.cpp @@ -369,7 +369,7 @@ void MeshFastBuilder::Finish() } // std::sort(verts.begin(), verts.end()); - int threads = QThread::idealThreadCount(); + int threads = int(std::thread::hardware_concurrency()); MeshCore::parallel_sort(verts.begin(), verts.end(), std::less<>(), threads); QVector indices(ulCtPts); diff --git a/src/Mod/Mesh/App/Core/Evaluation.cpp b/src/Mod/Mesh/App/Core/Evaluation.cpp index 5397320bef..6b6c8820e6 100644 --- a/src/Mod/Mesh/App/Core/Evaluation.cpp +++ b/src/Mod/Mesh/App/Core/Evaluation.cpp @@ -991,7 +991,7 @@ void MeshKernel::RebuildNeighbours(FacetIndex index) // sort the edges // std::sort(edges.begin(), edges.end(), Edge_Less()); - int threads = QThread::idealThreadCount(); + int threads = int(std::thread::hardware_concurrency()); MeshCore::parallel_sort(edges.begin(), edges.end(), Edge_Less(), threads); PointIndex p0 = POINT_INDEX_MAX, p1 = POINT_INDEX_MAX; diff --git a/src/Mod/Mesh/App/Core/Functional.h b/src/Mod/Mesh/App/Core/Functional.h index d33a1cdda6..63d64d5cd8 100644 --- a/src/Mod/Mesh/App/Core/Functional.h +++ b/src/Mod/Mesh/App/Core/Functional.h @@ -23,9 +23,8 @@ #ifndef MESH_FUNCTIONAL_H #define MESH_FUNCTIONAL_H -#include -#include #include +#include namespace MeshCore @@ -39,18 +38,25 @@ static void parallel_sort(Iter begin, Iter end, Pred comp, int threads) else { Iter mid = begin + (end - begin) / 2; if (threads == 2) { - QFuture future = - QtConcurrent::run(parallel_sort, begin, mid, comp, threads / 2); + auto future = std::async(parallel_sort, begin, mid, comp, threads / 2); std::sort(mid, end, comp); - future.waitForFinished(); + future.wait(); } else { - QFuture a = - QtConcurrent::run(parallel_sort, begin, mid, comp, threads / 2); - QFuture b = - QtConcurrent::run(parallel_sort, mid, end, comp, threads / 2); - a.waitForFinished(); - b.waitForFinished(); + auto a = std::async(std::launch::async, + parallel_sort, + begin, + mid, + comp, + threads / 2); + auto b = std::async(std::launch::async, + parallel_sort, + mid, + end, + comp, + threads / 2); + a.wait(); + b.wait(); } std::inplace_merge(begin, mid, end, comp); }