
Reading Updated/Latest Value in Multithreading Environment
In a multithreaded environment, there are always doubts about the latest value that a variable is holding, since there can be numerous thread instances updating, and also holding localized copies of the same variable, to consider. Try to use the volatile keyword and the magic is visible. Using the volatile