Re: What does volatile guarantee?
On 2/13/2010 3:34 PM, Arne Vajh??j wrote:
[...]
And I don't think it was me that switched to non volatile. Both
Roedy and Eric were referring to something being non atomic
in the old days.
And my recollection was mistaken on at least two counts:
- I believed that in the Old Days even volatile could not
guarantee atomic loads and stores of long and double variables.
This was incorrect: Loads and stores of volatile variables of
all kinds are and always have been atomic, possibly requiring
JVM magic to make them so.
- I believed that non-atomicity of loads and stores for
longs and doubles was a thing of the past. This is not so: A
non-volatile long or double may still be accessed non-atomically,
even today. (Accesses to narrower types and to references, even
to 64-bit references, are and always have been atomic whether
volatile or non-volatile.)
Sorry for the misinformation, and thanks for the correction.
--
Eric Sosman
esosman@ieee-dot-org.invalid