volatile是什么

volatile是JVM提供的轻量级的同步机制

1 保证可见性

2 不保证原子性

3 禁止指令重排(保证有序性)

posted @ 2021-07-14 22:01  chentaohere  阅读(92)  评论(0)    收藏  举报