> On 24 Aug 2016, at 15:48, Martin Buchholz <marti...@google.com> wrote: > > Below it seems like weakCompareAndSetVolatile is susceptible to spurious > failure as much as other weak cas variants and so should have the same kind > of retry loop. > > { > boolean success = false; > for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { > success = vh.weakCompareAndSetRelease(array, i, > VALUE_1, VALUE_2); > } > assertEquals(success, true, "weakCompareAndSetRelease > $type$"); > $type$ x = ($type$) vh.get(array, i); > assertEquals(x, VALUE_2, "weakCompareAndSetRelease > $type$"); > } > > { > boolean r = vh.weakCompareAndSetVolatile(array, i, > VALUE_2, VALUE_1); > assertEquals(r, true, "weakCompareAndSetVolatile $type$"); > $type$ x = ($type$) vh.get(array, i); > assertEquals(x, VALUE_1, "weakCompareAndSetVolatile > $type$ value"); > }
Thanks, i will update, Paul.