RFR 8162108 Rename weakCompareAndSetVolatile to weakCompareAndSet

Martin Buchholz martinrb at google.com
Wed Aug 24 22:48:48 UTC 2016


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");
                }


More information about the core-libs-dev mailing list