00af0ebb |
1 | // Created on: 2014-08-19 |
2 | // Created by: Alexander Zaikin |
3 | // Copyright (c) 1996-1999 Matra Datavision |
4 | // Copyright (c) 2013-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | // Version of parallel executor used when TBB is available |
18 | #ifdef HAVE_TBB |
19 | |
20 | #include <OSD_Parallel.hxx> |
21 | #include <Standard_ProgramError.hxx> |
22 | |
23 | #include <tbb/parallel_for.h> |
24 | #include <tbb/parallel_for_each.h> |
25 | #include <tbb/blocked_range.h> |
26 | |
27 | //======================================================================= |
28 | //function : forEach |
29 | //purpose : |
30 | //======================================================================= |
31 | |
32 | void OSD_Parallel::forEach (UniversalIterator& theBegin, |
33 | UniversalIterator& theEnd, |
6f498847 |
34 | const FunctorInterface& theFunctor, |
35 | Standard_Integer theNbItems) |
00af0ebb |
36 | { |
6f498847 |
37 | (void )theNbItems; |
00af0ebb |
38 | try |
39 | { |
40 | tbb::parallel_for_each(theBegin, theEnd, theFunctor); |
41 | } |
42 | catch (tbb::captured_exception& anException) |
43 | { |
44 | throw Standard_ProgramError(anException.what()); |
45 | } |
46 | } |
47 | |
48 | #endif /* HAVE_TBB */ |