LINUX 进程间 信号
2010-05-09 14:32
246 查看
#include <iostream> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #include <stdlib.h> #include <signal.h> using namespace std; extern char **environ; void signal_handle(int signal_no){ cout << "sign:" <<signal_no << endl; } int main(int args,char *argc[]){ pid_t pid=fork(); if(pid<0){ cout << "fork error!" <<endl; }else if(pid==0){ signal(SIGUSR1,signal_handle_kill); int count=0; while(count<10){ count++; cout << "count:" <<count <<endl; sleep(1); } kill(getppid(),SIGUSR1); }else{ signal(SIGUSR1,signal_handle); pause(); } }
相关文章推荐
- linux 进程通信---信号signal
- linux下的僵尸进程处理SIGCHLD信号
- 二十八、Linux 进程与信号---前台进程组
- 【转载】linux杀死进程以及发送或响应信号
- 信号退出【Linux学习笔记】kill及kill -9的用法及如何实现进程的优雅退出
- Linux进程间通信--进程,信号,管道,消息队列,信号量,共享内存
- [linux] C语言Linux系统编程-捕获进程信号
- Linux进程 捕获信号
- linux下的僵尸进程处理SIGCHLD信号
- Linux进程间通信--进程,信号,管道,消息队列,信号量,共享内存
- linux 进程信号集合 sigset_t
- linux进程通信---几个发送信号的函数(kill,raise,alarm,pause)
- Linux 进程信号列表
- linux信号处理--通过发送信号控制进程
- Linux 进程与信号
- linux中的信号2——进程如何处理信号?
- Linux下对后台进程通过kill传递信号不起作用的问题
- Linux程序设计--进程与信号
- [Linux信号]进程间使用信号进行同步
- Linux 进程与信号的概念和操作 linux process and signals