PKGBUILDs/community/opencascade/opencascade-tbb-2021.patch
2022-01-12 00:22:50 +00:00

33 lines
1.2 KiB
Diff

--- a/src/OSD/OSD_Parallel_TBB.cxx
+++ b/src/OSD/OSD_Parallel_TBB.cxx
@@ -25,7 +25,7 @@ Standard_DISABLE_DEPRECATION_WARNINGS
#include <tbb/parallel_for.h>
#include <tbb/parallel_for_each.h>
#include <tbb/blocked_range.h>
-#include <tbb/task_scheduler_init.h>
+#include <tbb/global_control.h>
Standard_ENABLE_DEPRECATION_WARNINGS
//=======================================================================
@@ -38,19 +38,12 @@ void OSD_Parallel::forEachExternal (UniversalIterator& theBegin,
const FunctorInterface& theFunctor,
Standard_Integer theNbItems)
{
- try
- {
const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
const Standard_Integer aNbThreads = theNbItems > 0 ?
aThreadPool->NbDefaultThreadsToLaunch() : -1;
- tbb::task_scheduler_init aScheduler (aNbThreads);
+ tbb::global_control global_limit(tbb::global_control::max_allowed_parallelism, aNbThreads);
tbb::parallel_for_each (theBegin, theEnd, theFunctor);
- }
- catch (tbb::captured_exception& anException)
- {
- throw Standard_ProgramError (anException.what());
- }
}
#endif /* HAVE_TBB */