linux 定时中断测试一
该程序代码较少,主要是测试
/**
* alarm1.c
*/
#include<stdio.h>
#include<signal.h>
#define ATIME 4
void ring();
int main(int ac,char *av[])
{
signal(SIGALRM,ring); //定时中断处理
printf("%d seconds ring.\n",ATIME);
alarm(ATIME);
pause();
return 0;
}
void ring()
{
printf("ring.ring.ring.\n");
}
* alarm1.c
*/
#include<stdio.h>
#include<signal.h>
#define ATIME 4
void ring();
int main(int ac,char *av[])
{
signal(SIGALRM,ring); //定时中断处理
printf("%d seconds ring.\n",ATIME);
alarm(ATIME);
pause();
return 0;
}
void ring()
{
printf("ring.ring.ring.\n");
}