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

This commit is contained in:
Sergey Sharybin
2017-12-22 16:37:25 +01:00
parent 870840e8b7
commit 6efd58dd3e

View File

@@ -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) {