I am trying to have a program that uses multiple forks.
I used this example to get myself started
Multiple fork() Concurrency
它是完美的。 然而,当我试图在儿童身上添加一个这样的文字:
if ((p = fork()) == 0) {
// Child process: do your work here
printf("child %i
", ii);
exit(0);
}
这一进程从未结束。 我如何在儿童身上打脚,让父母们继续完成方案的执行?