java.nio.*Buffer read/write atomicity (original) (raw)

Vitaly Davidovich vitalyd at gmail.com
Thu Dec 20 18:03:07 UTC 2012


But why would there be astonishment/surprise here if it says it's not threadsafe? I guess that's the part I'm having trouble understanding.

Sent from my phone On Dec 20, 2012 12:54 PM, "Aleksey Shipilev" <aleksey.shipilev at oracle.com> wrote:

On 12/20/2012 09:49 PM, Vitaly Davidovich wrote: > Just curious - what's the driver for this? Suppose it did have full > width writes/reads - you still shouldn't use it in a data racey way > since it's not spec'd to be threadsafe and you can only observe torn > reads/writes if you access it without synchronization.

The driver is the infamous "principle of least astonishment", aided by my purism. Java is remarkable in the way it deals with races, trying to surprise the least when something breaks. I think the change that brings in more consistency without sacrificing maintainability and/or performance is the change we endorse, right? -Aleksey.



More information about the core-libs-dev mailing list