volatile的作用

volatile用来定义某个变量的值可能在别的地方被修改,因此编译器不能对此变量做任何优化。

 

volatile

Volatile is used to define a variable that may be altered from outside the program. Therefore, the compiler cannot perform optimizations.

 

你可能感兴趣的:(volatile的作用)