Commit: 93240ba7988854d2d38290f4534df4a8ecccc193
Author: Bastien Montagne
Date: Sat May 14 18:02:34 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB93240ba7988854d2d38290f4534df4a8ecccc193
Fix an error in new lockfree parallel_range_next_iter_get() helper.
Reading the shared state->iter value after storing it in the 'reference' var
could in theory
lead to a race condition setting state->iter value above state->stop, which
would be 'deadly'.
This **may** be the cause of T48422, though I was not able to reproduce that
issue so far.
===================================================================
M source/blender/blenlib/intern/task.c
===================================================================
diff --git a/source/blender/blenlib/intern/task.c
b/source/blender/blenlib/intern/task.c
index 2e68e5a..a61b027 100644
--- a/source/blender/blenlib/intern/task.c
+++ b/source/blender/blenlib/intern/task.c
@@ -784,13 +784,13 @@ BLI_INLINE bool parallel_range_next_iter_get(
{
uint32_t n, olditer, previter, newiter;
- if (state->iter >= state->stop) {
+ if (UNLIKELY(state->iter >= state->stop)) {
return false;
}
do {
olditer = state->iter;
- n = min_ii(state->chunk_size, state->stop - state->iter);
+ n = min_ii(state->chunk_size, state->stop - olditer);
newiter = olditer + n;
previter = atomic_cas_uint32((uint32_t *)&state->iter, olditer,
newiter);
} while (UNLIKELY(previter != olditer));
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs