当前位置: 技术问答>linux和unix
菜鸟 请问一个定时器的问题
来源: 互联网 发布时间:2015-11-11
本文导语: 本人是初学者,想实现一个定时器,定时打印一条语句 可是,这样写,却没有反应 清高手指教 void pringmsg(){ printf("hellon"); } int main(){ struct sigevent event ; timer_t time; struct itimerspec value; event.sigev_notify = SIGEV_THREAD...
本人是初学者,想实现一个定时器,定时打印一条语句
可是,这样写,却没有反应
清高手指教
void pringmsg(){
printf("hellon");
}
int main(){
struct sigevent event ;
timer_t time;
struct itimerspec value;
event.sigev_notify = SIGEV_THREAD;
event.sigev_notify_function = printmsg;
event.sigev_value.sigval_ptr = (void*)&time;
if (timer_create(CLOCK_REALTIME,&event,&time)
可是,这样写,却没有反应
清高手指教
void pringmsg(){
printf("hellon");
}
int main(){
struct sigevent event ;
timer_t time;
struct itimerspec value;
event.sigev_notify = SIGEV_THREAD;
event.sigev_notify_function = printmsg;
event.sigev_value.sigval_ptr = (void*)&time;
if (timer_create(CLOCK_REALTIME,&event,&time)