RFR 8162108 Rename weakCompareAndSetVolatile to weakCompareAndSet

Paul Sandoz paul.sandoz at oracle.com
Wed Aug 24 23:12:31 UTC 2016


> On 24 Aug 2016, at 15:48, Martin Buchholz <martinrb at 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.


More information about the core-libs-dev mailing list