以上来源于: WordNet
A background thread might read this sensor every few seconds and update a volatile variable containing the current temperature.
一个后台线程可能会每隔几秒读取一次该传感器,并更新包含当前文档的volatile变量。
The idea here is that the volatile variable initialized acts as a guard to indicate that a set of other operations have completed.
这里的思想是使用易失性变量 initialized 担任守卫来表明一套别的操作已经完成了。
Happens-before orderings across threads are only created by synchronizing on a common lock or accessing a common volatile variable.
只有在通用锁上执行同步或访问一个通用的可变变量时,才能创建跨线程的Happens - before排序。
应用推荐