Java的long、double类型的原子性读取问题
In programming, an atomic action is one that effectively happens all at once. An atomic action cannot stop in the middle: it either happens completely, or it doesn’t happen at all. No side effects of an atomic action are visible until the action is complete.
以上是关于原子性的操作的相关描述。
在Java中,以下的操作可以认为是原子操作
- 对于引用变量、大多数的原始类型变量的读、写(所有的类型除了
long
和double
)都是原子性的(