diff options
author | Mai Lavelle <mai.lavelle@gmail.com> | 2017-08-23 07:40:04 +0300 |
---|---|---|
committer | Mai Lavelle <mai.lavelle@gmail.com> | 2017-08-23 13:54:25 +0300 |
commit | 2540741dee789f752687198c6f272a995d45073e (patch) | |
tree | 4d03f3ce032f67fdb3704b461bc51c3d02b6e7e1 /intern/cycles/util/util_atomic.h | |
parent | 5c60721c9e3d5af2bd4f80b3013fe0c804cf7531 (diff) |
Fix implementation of atomic update max and move to a central location
While unlikely to have had any serious effects because of limited use, the
previous implementation was not actually atomic due to a data race and
incorrectly coded CAS loop. We also had duplicates of this code in a few
places, it's now been moved to a single location with all other atomic
operations.
Diffstat (limited to 'intern/cycles/util/util_atomic.h')
-rw-r--r-- | intern/cycles/util/util_atomic.h | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/intern/cycles/util/util_atomic.h b/intern/cycles/util/util_atomic.h index 643af87a65f..f3c7ae546a0 100644 --- a/intern/cycles/util/util_atomic.h +++ b/intern/cycles/util/util_atomic.h @@ -22,16 +22,6 @@ /* Using atomic ops header from Blender. */ #include "atomic_ops.h" -ATOMIC_INLINE void atomic_update_max_z(size_t *maximum_value, size_t value) -{ - size_t prev_value = *maximum_value; - while(prev_value < value) { - if(atomic_cas_z(maximum_value, prev_value, value) != prev_value) { - break; - } - } -} - #define atomic_add_and_fetch_float(p, x) atomic_add_and_fetch_fl((p), (x)) #define atomic_fetch_and_inc_uint32(p) atomic_fetch_and_add_uint32((p), 1) |