-
Notifications
You must be signed in to change notification settings - Fork 46k
Closed
Labels
enhancementNew feature or request or suggestionNew feature or request or suggestion
Description
在Java多线程学习(三)volatile关键字这篇文章中对volatile关键字不具有原子操作的例子并不能说明volatile不具有原子性,打印结果会出现非99(例子中的74)是由于该线程执行到打印行的时候其他线程还处于循环中,所以加synchronized关键字不过是让线程执行到打印行的时候其他线程无法拿到锁进入循环,原子性不等于同步。
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request or suggestionNew feature or request or suggestion