清单 4. 忽略 SIGCHLD 信号


/*
 * Listing 4:
 * Ignoring the SIGCHLD signal
 * Ivan Griffin (ivan.griffin@ul.ie)
 */
#include <signal.h>
struct sigaction ignoreChildDeath =
{
    NULL, 0, SA_NOCLDSTOP | SA_RESTART, NULL
};
int main(int argc, char *argv[])
{
    /*
     * somewhere in main code
     */
    sigaction(SIGCHLD, &ignoreChildDeath, NULL);
    /*
     * other code
     */
    return 0;
}
© . All rights reserved.