[concurrency-interest] Stricter read ordering
thobes at gmail.com
Wed Apr 23 09:11:08 EDT 2014
On 23 Apr 2014, at 15:05 , Vitaly Davidovich <vitalyd at gmail.com> wrote:
> Right. Otherwise, the loads of x and/or y can move after the load of next and you may read "ahead" (I.e. read of next catches the old unchanged value but x and y catch the newly written ones, leading to loop exiting but having newer x and y that don't match next).
Yes, that is exactly the problem I want to solve. Unsafe.loadFence() solves it, as Aleksey elegantly points out.
So I guess my question amounts to: how do I do the same thing as Unsafe.loadFence(), which is introduced in Java 8, in Java 7.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest