Created
August 19, 2011 07:30
-
-
Save zunda/1156261 to your computer and use it in GitHub Desktop.
A code not to create zombies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void sigchld(int x); | |
static void | |
sigchld(int x __attribute__ ((unused))) | |
{ | |
while(waitpid(-1, NULL, WNOHANG) > 0); | |
signal(SIGCHLD, sigchld); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fork()する前に親から
signal(SIGCHLD, sigchld);
しておくみたい。