没有等待超时的等待呼叫。
您可以做的是安装一个为SIGCHLD设置标志的信号处理程序,并使用select()实现超时。select()将被信号中断。
static volatile int punt;static void sig_handler(int sig){ punt = 1;}...struct timeval timeout = {10,0};int rc;signal(SIGCHLD, sig_handler);fork/exec stuff//select will get interrupted by a signalrc = select(0, NULL,NULL,NULL, &timeout ); if (rc == 0) {// timed out} else if (punt) { //child terminated}如果您还有其他信号需要处理,则需要更多的逻辑



