我有一个与Posix Timer(timer_create())相关联的任务,每20 ms/50 Hz执行一次.在大多数情况下工作正常,除了每隔334.5秒(大约),计时器在一个周期的早期执行10毫秒.对于接下来的334.5-ish秒,间隔再次为20毫秒.
我已经包含了配置计时器的相关代码.该应用程序在Gumstix Verdex Pro XL6P上运行,并带有Gumstix的默认Linux版本.我还安排了FIFO调度算法.
我的直觉说这是一个整数溢出问题.也许还有其他东西使用相同的信号?我一直能够重现跳过,跨板上的执行和会话.
这个问题不是一个显示阻止,但我真的很想知道为什么会这样.
这是配置计时器的代码:
//------------------------------------------------------------------------------
// Create a timer which fires at the specified time and calls a timer event
// handler.
//
// handler : function to be called when the timer expires
// us : number of microseconds to add to timer
// ms : number of milliseconds to add to timer
// sec : number of seconds to add to timer
//------------------------------------------------------------------------------
void createTimer(void (*handler)(void), uint32 us, uint32 ms, uint32 …Run Code Online (Sandbox Code Playgroud)