标签:wait == info char printf send main 图片 else
//销毁僵尸进程2
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
int main(int argc, char *argv[])
{
int status;
pid_t pid=fork();
if (pid==0)
{
sleep(15);
return 24;
}
else
{
while(!waitpid(-1,&status,WNOHANG))
{
sleep(3);
puts("sleep 3sec.");
}
if(WIFEXITED(status))
{
printf("child send %d\n",WEXITSTATUS(status));
}
return 0;
}
}
标签:wait == info char printf send main 图片 else
原文地址:https://www.cnblogs.com/shiheyuanfang/p/14391623.html