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

#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);
}

猜你喜欢

转载自macrotea.iteye.com/blog/788125
今日推荐