我想使用异步计时器,它在到期时触发回调函数.我想要微秒级的精度.我的代码流程就像这样..
timer_t tid;
struct itimerspec val;
val.it_value.tv_sec = 0;
val.it_value.tv_nsec = 100000;
value.it_interval.tv_sec = 0;
value.it_interval.tv_nsec = 100000;
timer_create (CLOCK_REALTIME, NULL, &tid);
timer_connect (tid, myfunc,0);
timer_settime (tid, 0, &val, NULL);
and write my handle function:
myfunc(){
blah blah blah...
}
Run Code Online (Sandbox Code Playgroud)
我认为在最近的Linux版本中没有使用timer_connect.我有替代方案吗?
谢谢,