7 ms·
>if [a JVM thread] reads a field of an object, and another thread writes to the same field of the same object, then the program will see either the old value, o
by wgren 15y ago
>if [a JVM thread] reads a field of an object, and another thread writes to the same field of the same object, then the program will see either the old value, or the new value, but not something else entirely
Nitpick: unless the field in questions is a "long" or "double". In those cases the operation becomes two bytecodes and you can in fact see something else entirely if you are unlucky. At least it used to be like that.
- palish 15y agoOn 32-bit platforms. On 64-bit, you won't. =)