Task scheduler: Clarify why do we need an atomic add of 0
This commit is contained in:
parent
870840e8b7
commit
6efd58dd3e
Notes:
blender-bot
2023-02-14 06:17:20 +01:00
Referenced by issue #53683, 2.79a release
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue