diff --git a/src/OSD/OSD_Parallel_TBB.cxx b/src/OSD/OSD_Parallel_TBB.cxx index 2344a6ca2..e1a3d89de 100644 --- a/src/OSD/OSD_Parallel_TBB.cxx +++ b/src/OSD/OSD_Parallel_TBB.cxx @@ -25,7 +25,7 @@ Standard_DISABLE_DEPRECATION_WARNINGS #include #include #include -#include +#include 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 */