46 lines
1.9 KiB
Diff
46 lines
1.9 KiB
Diff
|
X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FOSD%2FOSD_Parallel_TBB.cxx;h=0b9022b57630b98a47ed090eff8233c5d15148bb;hp=2344a6ca2df9c2d01c8a73579060c9cb44d3d789;hb=740833a6a88e481f474783c426b6f6311ed586d3;hpb=20095306111bc6e035c001e719231a894bdd6882
|
||
|
|
||
|
diff --git a/src/OSD/OSD_Parallel_TBB.cxx b/src/OSD/OSD_Parallel_TBB.cxx
|
||
|
index 2344a6ca2d..0b9022b576 100644
|
||
|
--- a/src/OSD/OSD_Parallel_TBB.cxx
|
||
|
+++ b/src/OSD/OSD_Parallel_TBB.cxx
|
||
|
@@ -25,7 +25,9 @@ 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>
|
||
|
+#if TBB_VERSION_MAJOR < 2021
|
||
|
+ #include <tbb/task_scheduler_init.h>
|
||
|
+#endif
|
||
|
Standard_ENABLE_DEPRECATION_WARNINGS
|
||
|
|
||
|
//=======================================================================
|
||
|
@@ -38,12 +40,16 @@ void OSD_Parallel::forEachExternal (UniversalIterator& theBegin,
|
||
|
const FunctorInterface& theFunctor,
|
||
|
Standard_Integer theNbItems)
|
||
|
{
|
||
|
+#if TBB_VERSION_MAJOR >= 2021
|
||
|
+ // task_scheduler_init is removed,
|
||
|
+ // exceptions are captured without proxy tbb::captured_exception object
|
||
|
+ (void )theNbItems;
|
||
|
+ tbb::parallel_for_each (theBegin, theEnd, theFunctor);
|
||
|
+#else
|
||
|
try
|
||
|
{
|
||
|
const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
|
||
|
- const Standard_Integer aNbThreads = theNbItems > 0 ?
|
||
|
- aThreadPool->NbDefaultThreadsToLaunch() : -1;
|
||
|
-
|
||
|
+ const Standard_Integer aNbThreads = theNbItems > 0 ? aThreadPool->NbDefaultThreadsToLaunch() : -1;
|
||
|
tbb::task_scheduler_init aScheduler (aNbThreads);
|
||
|
tbb::parallel_for_each (theBegin, theEnd, theFunctor);
|
||
|
}
|
||
|
@@ -51,6 +57,7 @@ void OSD_Parallel::forEachExternal (UniversalIterator& theBegin,
|
||
|
{
|
||
|
throw Standard_ProgramError (anException.what());
|
||
|
}
|
||
|
+#endif
|
||
|
}
|
||
|
|
||
|
#endif /* HAVE_TBB */
|