等待所有子进程结束:
pid_t pr;
do {
pr = waitpid(0, NULL, WNOHANG);
printf("pid %d\n",pr);
if (pr==0) {
printf("I'm the father process, the child process not exited\n");
}
} while (pr==0);
等待所有子进程结束:
pid_t pr;
do {
pr = waitpid(0, NULL, WNOHANG);
printf("pid %d\n",pr);
if (pr==0) {
printf("I'm the father process, the child process not exited\n");
}
} while (pr==0);