`

进程间的通讯-软中断信号

阅读更多
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<signal.h>

/*软中断信号例子*/
/*定义*/
void handle();
int tmep;

void handle(){
	tmep=0;
}

main(){
	/*预设软中断信号对应的函数,将覆盖系统默认*/
	signal(SIGINT,handle);
	tmep=1;
	while(tmep==1){
		printf("hello!\n");
	}
	printf("you press ctrl+c!OK!\n");
	exit(0);
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics