摘要:
volatile:它是被设计用来修饰被不同线程访问和修改的变量一般用在以下3个地方:1、多进程多任务共享的标志需要加上它2、中断服务中被修改并且被其它程序检测的变量需要加上它3、并行设备的硬件寄存器(如:状态寄存器)msdn中volatile的定义是”A type qualifier that you can use to declare that an object can be modified in the program by the hardware“例如:static int i;int main(){ while(true) { if(i) ... 阅读全文