Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-06-16 17:13:53 +0300
committerJacques Lucke <jacques@blender.org>2021-06-16 17:14:02 +0300
commit45d59e0df5fe749d428ebf662b61844561df64c4 (patch)
treea70616dc409c67006956ac149bd43efa22c61bc4 /source/blender/blenlib
parent0cebe554d13bf1ea4c81fd4addee30dd4ea4d2f1 (diff)
BLI: add threading namespace
This namespace groups threading related functions/classes. This avoids adding more threading related stuff to the blender namespace. Also it makes naming a bit easier, e.g. the c++ version of BLI_task_isolate could become blender::threading::isolate_task or something similar. Differential Revision: https://developer.blender.org/D11624
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_enumerable_thread_specific.hh4
-rw-r--r--source/blender/blenlib/BLI_task.hh4
-rw-r--r--source/blender/blenlib/intern/mesh_boolean.cc6
3 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenlib/BLI_enumerable_thread_specific.hh b/source/blender/blenlib/BLI_enumerable_thread_specific.hh
index 89be4cad848..a05f7724dd2 100644
--- a/source/blender/blenlib/BLI_enumerable_thread_specific.hh
+++ b/source/blender/blenlib/BLI_enumerable_thread_specific.hh
@@ -26,7 +26,7 @@
#include "BLI_map.hh"
#include "BLI_utility_mixins.hh"
-namespace blender {
+namespace blender::threading {
namespace enumerable_thread_specific_utils {
inline std::atomic<int> next_id = 0;
@@ -70,4 +70,4 @@ template<typename T> class EnumerableThreadSpecific : NonCopyable, NonMovable {
#endif /* WITH_TBB */
};
-} // namespace blender
+} // namespace blender::threading
diff --git a/source/blender/blenlib/BLI_task.hh b/source/blender/blenlib/BLI_task.hh
index 8e963c958b2..cdf7759ef41 100644
--- a/source/blender/blenlib/BLI_task.hh
+++ b/source/blender/blenlib/BLI_task.hh
@@ -44,7 +44,7 @@
#include "BLI_index_range.hh"
#include "BLI_utildefines.h"
-namespace blender {
+namespace blender::threading {
template<typename Range, typename Function>
void parallel_for_each(Range &range, const Function &function)
@@ -75,4 +75,4 @@ void parallel_for(IndexRange range, int64_t grain_size, const Function &function
#endif
}
-} // namespace blender
+} // namespace blender::threading
diff --git a/source/blender/blenlib/intern/mesh_boolean.cc b/source/blender/blenlib/intern/mesh_boolean.cc
index c5c830bb4dd..9f7824a0029 100644
--- a/source/blender/blenlib/intern/mesh_boolean.cc
+++ b/source/blender/blenlib/intern/mesh_boolean.cc
@@ -1983,7 +1983,7 @@ static void populate_comp_bbs(const Vector<Vector<int>> &components,
* absolute value of any coordinate. Do it first per component,
* then get the overall max. */
Array<double> max_abs(components.size(), 0.0);
- parallel_for(components.index_range(), comp_grainsize, [&](IndexRange comp_range) {
+ threading::parallel_for(components.index_range(), comp_grainsize, [&](IndexRange comp_range) {
for (int c : comp_range) {
BoundingBox &bb = comp_bb[c];
double &maxa = max_abs[c];
@@ -2691,7 +2691,7 @@ static IMesh raycast_tris_boolean(const IMesh &tm,
tbb::spin_mutex mtx;
# endif
const int grainsize = 256;
- parallel_for(IndexRange(tm.face_size()), grainsize, [&](IndexRange range) {
+ threading::parallel_for(IndexRange(tm.face_size()), grainsize, [&](IndexRange range) {
Array<float> in_shape(nshapes, 0);
Array<int> winding(nshapes, 0);
for (int t : range) {
@@ -3391,7 +3391,7 @@ static IMesh polymesh_from_trimesh_with_dissolve(const IMesh &tm_out,
}
/* For now: need plane normals for all triangles. */
const int grainsize = 1024;
- parallel_for(tm_out.face_index_range(), grainsize, [&](IndexRange range) {
+ threading::parallel_for(tm_out.face_index_range(), grainsize, [&](IndexRange range) {
for (int i : range) {
Face *tri = tm_out.face(i);
tri->populate_plane(false);