[concurrency-interest] AtomicReference weakCompareAndSet "Mayfailspuriously"?

Pete Soper pete at soper.us
Sun May 28 23:24:28 EDT 2006


Bob Lee wrote:
> On 5/28/06, Pete Soper <pete at soper.us> wrote:
>> The race is between the write of int[] and int[]{1} but it's enabled by
>> the lack of atomicity of the CAS.
>
> The CAS itself is atomic, right? The problem now is with the int[]
> which is exposed to two threads with no barrier. If we were doing a
> weak CAS of an int, this wouldn't be an issue, right?

Yes! OK, I see both the atomicity and the data race now.
>
> Bob
>



More information about the Concurrency-interest mailing list