【发布时间】:2014-07-27 09:38:48
【问题描述】:
如果我在 xcode 中运行这段代码,子进程退出时睡眠仅 1 秒后返回;但是当我在终端中制作并运行这段代码时,它会睡眠 10 秒;为什么??
int main(int argc, const char * argv[])
{
pid_t pid;
if ((pid = fork()) ==0) {
sleep(1);
}else{
sleep(10);
printf("hello");
}
return 0;
}
【问题讨论】: