分类: LINUX
2009-03-15 19:17:07
void init_timer() { struct itimerval value; //设置SIGALARM信号处理函数 signal(SIGALRM, redline_timer_func); //设置定时器 value.it_value.tv_sec=10; //间隔10s value.it_value.tv_usec=0; value.it_interval.tv_sec=10; value.it_interval.tv_usec=0; setitimer(ITIMER_REAL, &value, NULL); } ============================================== signal(SIGINT, sig_func); signal(SIGALRM, timer_func); GoDaemon(); init_timer(); |