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:
-rw-r--r--source/blender/blenlib/intern/task_pool.cc2
-rw-r--r--source/blender/blenlib/intern/task_range.cc12
-rw-r--r--source/blender/modifiers/intern/MOD_remesh.c9
3 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/task_pool.cc b/source/blender/blenlib/intern/task_pool.cc
index c4d60673492..42b635afcf1 100644
--- a/source/blender/blenlib/intern/task_pool.cc
+++ b/source/blender/blenlib/intern/task_pool.cc
@@ -114,7 +114,7 @@ class Task {
/* Execute task. */
void operator()() const
{
- run(pool, taskdata);
+ tbb::this_task_arena::isolate([this] { run(pool, taskdata); });
}
};
diff --git a/source/blender/blenlib/intern/task_range.cc b/source/blender/blenlib/intern/task_range.cc
index a8447c305e0..55de35f0060 100644
--- a/source/blender/blenlib/intern/task_range.cc
+++ b/source/blender/blenlib/intern/task_range.cc
@@ -89,11 +89,13 @@ struct RangeTask {
void operator()(const tbb::blocked_range<int> &r) const
{
- TaskParallelTLS tls;
- tls.userdata_chunk = userdata_chunk;
- for (int i = r.begin(); i != r.end(); ++i) {
- func(userdata, i, &tls);
- }
+ tbb::this_task_arena::isolate([this, r] {
+ TaskParallelTLS tls;
+ tls.userdata_chunk = userdata_chunk;
+ for (int i = r.begin(); i != r.end(); ++i) {
+ func(userdata, i, &tls);
+ }
+ });
}
void join(const RangeTask &other)
diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c
index cdb513595a1..5a262adf47c 100644
--- a/source/blender/modifiers/intern/MOD_remesh.c
+++ b/source/blender/modifiers/intern/MOD_remesh.c
@@ -25,6 +25,7 @@
#include "BLI_utildefines.h"
#include "BLI_math_base.h"
+#include "BLI_threads.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
@@ -177,7 +178,11 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx)
BLI_assert(false);
break;
}
-
+ /* TODO(jbakker): Dualcon crashes when run in parallel. Could be related to incorrect
+ * input data or that the library isn't thread safe. This was identified when changing the task
+ * isolations during T76553. */
+ static ThreadMutex dualcon_mutex = BLI_MUTEX_INITIALIZER;
+ BLI_mutex_lock(&dualcon_mutex);
output = dualcon(&input,
dualcon_alloc_output,
dualcon_add_vert,
@@ -188,6 +193,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx)
rmd->hermite_num,
rmd->scale,
rmd->depth);
+ BLI_mutex_unlock(&dualcon_mutex);
+
result = output->mesh;
MEM_freeN(output);
}