I have two threads that need to use one variable. They run forever and constantly needs the updated value of the variable. Now I am aware of the race condition and am using synchronized. However, the two threads are of different classes and I don't think synchronized is quite effective. The local memory is not reconciled with the main memory. Any idea on how I may go about solving this problem? (It also doesn't work without synchronized either)
Thanks all in advance.