父子进程交替报数----进程通信
实现:父子进程实现交替报数
父进程给子进程发送限号SIGUSR2
子进程给父进程发送信号SIGUSR1
由于父子进程通信,因此需要定义父进程和子进程各自的捕捉函数
//信号实现父子进程间通信
/*Parent send SIGUSR2*/
/*Child Send SIGUSR1*/
/*SIGUSR1,SIGUSR2 默认状态为杀死进程*/
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#i
原创
2021-07-26 14:57:20 ·
563 阅读 ·
0 评论