Commit: af83535dd0f2032c72abd62254f566da2db9f65b
Author: Sergey Sharybin
Date:   Mon Jan 22 12:56:35 2018 +0100
Branches: blender-v2.79a-release
https://developer.blender.org/rBaf83535dd0f2032c72abd62254f566da2db9f65b

Task scheduler: Clarify why do we need an atomic add of 0

===================================================================

M       source/blender/blenlib/intern/task.c

===================================================================

diff --git a/source/blender/blenlib/intern/task.c 
b/source/blender/blenlib/intern/task.c
index e050f3148b8..da632e92e08 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_uint32((uint32_t *)(&state.iter), 0);
 
        if (use_userdata_chunk) {

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to