What if v would be AtomicBolean?
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mechanical-sympathy/faf3e288-f249-4d07-830b-7752bb41a472n%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mechanical-sympathy/CAGuAWdCqwmySqhNkHRKZcouwKf0F3oM%3DHb_byqLwY8D3Hyb-Gg%40mail.gmail.com.
What about a such case:AtomicLong x;volatile boolean v;T1:v = true; (1)long a = x.incrementAndGet(); // a == 1 (2)T2:long b = x.incrementAndGet(); // b == 2 (3)Do I understand correctly that if T2 observes that x == 2 it also means that T2 observer v == true because of happens-before (1) -hb-> (2) -hb-> (3)?
To view this discussion on the web, visit https://groups.google.com/d/msgid/mechanical-sympathy/6d9273f2-986d-4e58-bfe1-f6a5a8e4fc71n%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/mechanical-sympathy/CAGuAWdAR%3DyDoeSXvDfmc18OcpHJ5dufDFnrfzY0mZiYyRR9Vjw%40mail.gmail.com.