Problems with non-atomic access example on GNU website
问题 On the website of GNU there is a simple example available which is supposed to demonstrate the problems appearing with non-atomic access. The example contains a small mistake, they have forgotten #include <unistd.h> : #include <signal.h> #include <stdio.h> #include <unistd.h> struct two_words { int a, b; } memory; static struct two_words zeros = { 0, 0 }, ones = { 1, 1 }; void handler(int signum) { printf ("%d,%d\n", memory.a, memory.b); alarm (1); } int main (void) { signal (SIGALRM, handler