linux下该如何取消用setitimer设置的定时器呢?
void init_sigaction(void)
{
struct sigaction tact;
tact.sa_handler = drawFrame_proc;
tact.sa_flags = 0;
sigemptyset(&tact.sa_mask);
sigaction(SIGALRM, &tact, NULL);
}
void init_time()
{
struct itimerval value;
value.it_value.tv_sec = 0;
value.it_value.tv_usec = 40000;
value.it_interval = value.it_value;
setitimer(ITIMER_REAL, &value, NULL);
}
请问该如何取消用setitimer设置的定时器呢。谢谢!
------解决方案--------------------setitimer设置it_interval和it_value为零。
------解决方案--------------------void uninit_time()
{
struct itimerval value;
value.it_value.tv_sec = 0;
value.it_value.tv_usec = 0;
value.it_interval = value.it_value;
setitimer(ITIMER_REAL, &value, NULL);
}