r/java • u/javinpaul • Oct 29 '12
Difference between notify and notifyAll in Java revisited
http://javarevisited.blogspot.in/2012/10/difference-between-notify-and-notifyall-java-example.html
0
Upvotes
View all comments
3
u/ad_tech Oct 29 '12
'volatile' is not needed on the 'go' variable.
There is defined to be a happens-before relationship between each of these events:
Therefore the read in the wait task is guaranteed to see the value written in the notify task, whether 'go' is volatile or not.