Hi,
While reading this double-check locking example, I tried to test out of order behavior of java memory model, using the same example.
But in all the runs all other threads were getting the same value as initialized by one thread.
Also next para 3.8.1 says
lock acquire -> invalidate memory to insure fields re-read from shared memory
lock released -> writeback to shared memory.
So if anyone has written this 3.8.1 program, which strengthens out-of-order behaviour, kindly explain.
I have uploaded source over here , which I tested, but any where I did not get anomaly.
http://pastebin.com/272HuQ1jor
https://sites.google.com/site/openassignment/home/Test2.java
--
o
| _ o |_ o __ _|
_| (_| | | | | | |(_|
Peeyush Agrawal.