【发布时间】:2012-08-06 08:14:43
【问题描述】:
从一个现有的问题here,有人给出了这个示例代码:
int status;
child_pid = fork();
if (child_pid == 0) {
// in child; do stuff including perhaps exec
} else if (child_pid == -1) {
// failed to fork
} else {
if (waitpid(child_pid, &status, 0) == child_pid) {
// child exited or interrupted; now you can do something with status
} else {
// error etc
}
}
谁能给我解释一下waitpid()的第二个参数是干什么用的?
【问题讨论】: