cleanup zombies during run, and check processes still exist
[tridge/junkcode.git] / forkspeed.c
1 #include <stdlib.h>       
2 #include <unistd.h>       
3 #include <signal.h>       
4 #include <sys/types.h>
5 #include <sys/wait.h>
6
7
8 int main(int argc, char *argv[])
9 {
10         int n = atoi(argv[1]);
11         
12         signal(SIGCHLD, SIG_IGN);
13
14         while (n--) {
15                 if (fork() == 0) exit(0);
16                 waitpid(-1, NULL, 0);
17         }
18         return 0;
19 }