Volatile can gaurantee execution order and solve double checked logging problem.
You can not use Volatile as a counter shared by multiple threads. For that you must use Atomic
see:
http://jeremymanson.blogspot.com/2007/08/volatile-does-not-mean-atomic.html
No comments:
Post a Comment