[concurrency-interest] Atomic assignment
davidcholmes at aapt.net.au
Fri May 8 22:26:17 EDT 2009
Mark Thornton writes:
> David Holmes wrote:
> > That bug is (or became) a RFE for the spec to make all accesses to
> > double/long atomic and that is not going to happen hence the
> > "will not fix". There are a number of other bugs that pertain
> > to atomic access to volatile long/double eg: 4247780 which was
> > fixed back in 1.2.2
> By all accesses I presume you mean including things like ++, which is
> reasonably well documented as not atomic.
No - "access" is a simple load or store. ++ is an assignment operator that
involves multiple operations: load, increment, store.
Not sure why this has suddenly stirred up confusion. As Sam Berlin
re-stated, all accesses to 32-bit types are atomic. The atomicity guarantee
extends to double and long if they are declared 'volatile'. No assignment
operators are defined to be atomic.
> 4247780 doesn't appear to exist in the bug database.
Sorry about that - that was actually a bug in the ExactVM which was the
production VM on Solaris. Hotspot has its own bugs with regard to volatile,
but as has been said the main bug was fixed years ago now.
More information about the Concurrency-interest