xinhao
来源:互联网 发布:简明python教程 中文 编辑:程序博客网 时间:2024/06/06 00:26
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <unistd.h>
int main()
{
pid_t pid;
int status;
if (!(pid = fork()))
{
printf("hi , i child process\n");
sleep(10);
return;
}
else
{
printf("send signal to child %d\n", pid);
sleep(1);
kill(pid, SIGABRT);
wait(&status);
if(WIFSIGNALED(status))
printf("child recive %d\n", WTERMSIG(status));
}
}
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <unistd.h>
int main()
{
pid_t pid;
int status;
if (!(pid = fork()))
{
printf("hi , i child process\n");
sleep(10);
return;
}
else
{
printf("send signal to child %d\n", pid);
sleep(1);
kill(pid, SIGABRT);
wait(&status);
if(WIFSIGNALED(status))
printf("child recive %d\n", WTERMSIG(status));
}
}
阅读全文
0 0
- xinhao
- Tong bu xinhao
- Python小练习
- FOR UPDATE
- 6.29-6.30 LL--实习日志--Restful API 概念理解+Restful_API编写
- 转:Java学习之Iterator(迭代器)的一般用法
- Android获取系统储存以及内存信息(二)
- xinhao
- 使用 springmvc @response 返回 json 报错406
- 给MySQL添加超级用户权限
- 学习C++——lambda表达式
- linux:守护进程&模拟实现mydaemon
- NodeMCU教程 板载自带LED测试
- Winform的TextBox控件显示默认文本点击消失离开显示
- 万人网络5218传媒美拍涨粉加粉丝直播平台粉丝增加
- 欢迎使用CSDN-markdown编辑器