What would be best to use in which situation?
If you don't know what Volatile is:
[Only registered and activated users can see links. Click Here To Register...]
If you don't know what Volatile is:
[Only registered and activated users can see links. Click Here To Register...]
:DQuote:
Volatile keyword is used to define a variable which is to be modified across multiple threads without invoking lock statements(Although we do lock them most of the times). Volatile variables are not subject to compiler optimization and thus we will get the most updated value of the variable all the time. See the example below :