[concurrency-interest] dealing with people that questionvisibility problems
gregg at cytetech.com
Wed Feb 21 21:01:40 EST 2007
David Holmes wrote:
> Howver, going to the extreme of making every field either final or
> volatile is pointless. If a field has visibility issues because it
> isn't volatile, there's a good chance that it also has atomicity
> issues that volatile can't fix.
The issue that I see is that it is more possible to study code for a race
condition when you see the effects. These are more readily understood. It is
difficult to understand visibility related bugs and this particular optimization
because it just doesn't seem right that a variable could possibly not have the
So, declaring a variable volatile can create a more tractible behavior than will
be present when the compiler is optimizing the code to not behave as it is written.
More information about the Concurrency-interest