https://issues.apache.org/bugzilla/show_bug.cgi?id=44454

--- Comment #22 from Sebb <s...@apache.org> 2010-06-22 07:26:05 EDT ---
At the risk of stating the obvious:

32 bit reads and writes are guaranteed atomic by the JVM.

However, an arithmetic operation (e.g. increment) requires two operations: 
read and then write, and another thread can write the field between the two
atomic operations.

64 bit reads and writes are not even guaranteed atomic. This was to allow for
systems that did not have 64 bit operations, which therefore had to perform 2
off 32-bit operations. (Note: they probably are atomic on most modern systems,
depending on the alignment).

Adding volatile makes 64 bit reads and writes atomic, but does not protect
multiple operations such as increment.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to