Why the signal pause will cause the program to sleep forever?
<p>The APUE book says that: If the signal occurs after the test of <code>sig_int_flag</code> but before the call to <code>pause</code>, the process could go to sleep forever.</p>

<p>I don't know why, can somebody tells me?
Thanks a lot.</p>

<pre><code>int sig_int();                 /* my signal handling function */
int sig_int_flag;              /* set nonzero when signal occurs */

int main() {
    signal(SIGINT, sig_int)    /* establish handler */
    .
    .
    .
    while (sig_int_flag == 0)
        pause();               /* go to sleep, waiting for signal */
}

int sig_int() {
    signal(SIGINT, sig_int);   /* reestablish handler for next time */
    sig_int_flag = 1;          /* set flag for main loop to examine */
}
</code></pre>