mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0032697: Configuration - fix compilation errors with oneTBB 2021
Removed usage of no more existing tbb::task_scheduler_init and tbb::captured_exception.
This commit is contained in:
parent
2009530611
commit
740833a6a8
@ -25,7 +25,9 @@ Standard_DISABLE_DEPRECATION_WARNINGS
|
|||||||
#include <tbb/parallel_for.h>
|
#include <tbb/parallel_for.h>
|
||||||
#include <tbb/parallel_for_each.h>
|
#include <tbb/parallel_for_each.h>
|
||||||
#include <tbb/blocked_range.h>
|
#include <tbb/blocked_range.h>
|
||||||
|
#if TBB_VERSION_MAJOR < 2021
|
||||||
#include <tbb/task_scheduler_init.h>
|
#include <tbb/task_scheduler_init.h>
|
||||||
|
#endif
|
||||||
Standard_ENABLE_DEPRECATION_WARNINGS
|
Standard_ENABLE_DEPRECATION_WARNINGS
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -38,12 +40,16 @@ void OSD_Parallel::forEachExternal (UniversalIterator& theBegin,
|
|||||||
const FunctorInterface& theFunctor,
|
const FunctorInterface& theFunctor,
|
||||||
Standard_Integer theNbItems)
|
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
|
try
|
||||||
{
|
{
|
||||||
const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
|
const Handle(OSD_ThreadPool)& aThreadPool = OSD_ThreadPool::DefaultPool();
|
||||||
const Standard_Integer aNbThreads = theNbItems > 0 ?
|
const Standard_Integer aNbThreads = theNbItems > 0 ? aThreadPool->NbDefaultThreadsToLaunch() : -1;
|
||||||
aThreadPool->NbDefaultThreadsToLaunch() : -1;
|
|
||||||
|
|
||||||
tbb::task_scheduler_init aScheduler (aNbThreads);
|
tbb::task_scheduler_init aScheduler (aNbThreads);
|
||||||
tbb::parallel_for_each (theBegin, theEnd, theFunctor);
|
tbb::parallel_for_each (theBegin, theEnd, theFunctor);
|
||||||
}
|
}
|
||||||
@ -51,6 +57,7 @@ void OSD_Parallel::forEachExternal (UniversalIterator& theBegin,
|
|||||||
{
|
{
|
||||||
throw Standard_ProgramError (anException.what());
|
throw Standard_ProgramError (anException.what());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_TBB */
|
#endif /* HAVE_TBB */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user