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
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-12-22 18:37:25 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-12-22 18:37:25 +0300
commit6efd58dd3e2a6be696b00d68ad775d75def79b26 (patch)
tree421a86e67afdf4ae0682687645bcbb3ebf77f76b /source
parent870840e8b7dd8860691de0910ade3f0d0f217f14 (diff)
Task scheduler: Clarify why do we need an atomic add of 0
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/intern/task.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c
index 311be1dd151..afa20e3d766 100644
--- a/source/blender/blenlib/intern/task.c
+++ b/source/blender/blenlib/intern/task.c
@@ -1124,6 +1124,9 @@ static void task_parallel_range_ex(
}
num_tasks = min_ii(num_tasks, (stop - start) / state.chunk_size);
+
+ /* NOTE: This way we are adding a memory barrier and ensure all worker
+ * threads can read and modify the value, without any locks. */
atomic_fetch_and_add_int32(&state.iter, 0);
if (use_userdata_chunk) {