On Friday, 31 January 2014 at 11:31:53 UTC, Benjamin Thaut wrote:

For x86 CPUs you don't really need MemoryOrder.acq as reads are atomic by default.

Uhm... atomicLoad() itself guarantees that the read is atomic. It's not about atomicity of operation, it's about sequential consistency. Using raw in this case is safe because the further synchronized block guarantees that this read will not be reordered to follow write. In fact, the presence of that synchronized block allows for making both load and store raw.

Reply via email to