< prev index next >

src/java.base/share/classes/java/util/concurrent/atomic/LongAccumulator.java

Print this page
8234131: Miscellaneous changes imported from jsr166 CVS 2020-12
Reviewed-by: martin

*** 106,123 **** public void accumulate(long x) { Cell[] cs; long b, v, r; int m; Cell c; if ((cs = cells) != null || ((r = function.applyAsLong(b = base, x)) != b && !casBase(b, r))) { boolean uncontended = true; if (cs == null || (m = cs.length - 1) < 0 ! || (c = cs[getProbe() & m]) == null || !(uncontended = (r = function.applyAsLong(v = c.value, x)) == v || c.cas(v, r))) ! longAccumulate(x, function, uncontended); } } /** * Returns the current value. The returned value is <em>NOT</em> --- 106,124 ---- public void accumulate(long x) { Cell[] cs; long b, v, r; int m; Cell c; if ((cs = cells) != null || ((r = function.applyAsLong(b = base, x)) != b && !casBase(b, r))) { + int index = getProbe(); boolean uncontended = true; if (cs == null || (m = cs.length - 1) < 0 ! || (c = cs[index & m]) == null || !(uncontended = (r = function.applyAsLong(v = c.value, x)) == v || c.cas(v, r))) ! longAccumulate(x, function, uncontended, index); } } /** * Returns the current value. The returned value is <em>NOT</em>
< prev index next >