系统编程之进程管理 wait()
来源:互联网 发布:红警2网络找不到人 编辑:程序博客网 时间:2024/05/02 06:19
#include<unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <errno.h>
int main()
{
pid_t child;
/*创建子进程*/
if((child=fork())==-1)
{
printf("Fork Error:%s\n",strerror(errno));
exit(1);
}
else
if (child == 0) //child
{
printf("the child process is running \n");
sleep(1);
printf("I am the chil: %d\n",getpid());
exit(0);
}
else //parament
{
wait(NULL);//等到任一子进程退出,父进程才会运行
// waitpid(child,NULL,0); //等待特定的进程
printf("the father process starts run\n");
printf("I am the father: %d\n",getpid());
return 0;
}
}
- 系统编程之进程管理 wait()
- linux系统编程之进程(六):父进程查询子进程的退出,wait,waitpid
- linux系统编程之进程(四):wait/waitpid函数与僵尸进程、fork 2 times
- linux系统编程之进程(四):wait/waitpid函数与僵尸进程、fork 2 times
- 系统编程之进程管理 execl
- 系统编程之进程管理 pipe
- 进程管理之wait和waitpid
- Linux编程基础之进程等待(wait()函数)
- Linux编程基础之进程等待(wait()函数)
- Linux进程控制编程之fork、wait
- UNIX环境编程学习笔记(21)——进程管理之获取进程终止状态的 wait 和 waitpid 函数
- UNIX环境编程学习笔记(21)——进程管理之获取进程终止状态的 wait 和 waitpid 函数
- linux c语言编程中《进程的管理wait函数》
- 系统编程之进程管理 fork—pid
- 系统编程之进程管理 vfork—pid
- Linux系统进程控制编程(六)——wait和waitpid函数
- Linux系统进程控制编程--wait函数的使用
- Linux系统进程控制编程----wait函数使用
- 选择排序法
- perl的srand()函数使用,time的各个函数的使用
- 递归算法 解决fabonaci数列 C语言
- AJAX数据处理方式
- 关于android删除语音搜索功能的基本操作方法
- 系统编程之进程管理 wait()
- 题目:求两个方阵A,B的乘积
- How to set the QT Application icon in the windows.
- java中格式化日期,包含时区的
- 星号图(4)
- BootLoader与Linux内核的参数传递
- hadoop mr的数据流程交互简单描述
- 能用一条语句将形如"293,294,295"这样的数据转成游标吗?
- php计算器