1. To ensure visibility when different threads of volatile variables to be modified to operate all write operations can react immediately to the other thread, that one thread modifies the value of a variable, the value of this new variable to other volatile thread is immediately visible.
2. Prohibition of instruction reordering optimization.
volatile keyword semantic layers
Guess you like
Origin blog.csdn.net/qq_45287265/article/details/105055578
Recommended
Ranking