2).volatile和__volatile__: a. volatile是C语言定义的关键字，gcc为了需要又定义了__volatile__，它和 volatile表达的是同一意思。 b. volatile的本意是"易变的"，由于访问寄存器的速度快于访存，所以编译器一般 都会作优化以减少访存。如果变量加上volatile修饰，则编译器就不会对此变量 的读写操作进行优化，即不通过寄存器缓冲而直接访存。 c. __asm__ __volatile__一起指示编译器不要改动优化后面的汇编语句。
To avoid uncertainty about interrupting access to a variable, you can use a particular data type for which access is always atomic: sig_atomic_t. Reading and writing this data type is guaranteed
to happen in a single instruction, so there's no way for a handler to run “in the middle” of an access.
The type sig_atomic_t is always an integer data type, but which one it is, and how many bits it contains, may vary from machine to machine.
— Data Type: sig_atomic_t
This is an integer data type. Objects of this type are always accessed atomically.
In practice, you can assume that int is atomic. You can also assume that pointer types are atomic; that is very convenient. Both of these assumptions are true on all of the machines that the GNU
C library supports and on all POSIX systems we know of.