摘要: Greg Mattes推荐的介绍并发编程的书Java Concurrency in Practicevolatile 的语义:“… the volatile modifier guarantees that any thread that reads a field will see the most recently written value.”- Josh Bloch这意味着,对于被声明为volatile的域,当写操作发生时,所有的读操作都会看到这个change,既然有局部缓存存在。当一个域被synchronized 方法或代码块 guarded 的时候,就没必要把一个域声明为volat 阅读全文
posted @ 2013-11-22 20:03 ridox 阅读(178) 评论(0) 推荐(0) 编辑