提交 14dbee00 编写于 作者: B Bernard Xiong

Merge pull request #16 from grissiom/fix-timer

more deterministic on timer
......@@ -276,9 +276,15 @@ rt_err_t rt_timer_start(rt_timer_t timer)
/*
* It supposes that the new tick shall less than the half duration of
* tick max.
* tick max. And if we have two timers that timeout at the same time,
* it's prefered that the timer inserted early get called early.
*/
if ((t->timeout_tick - timer->timeout_tick) < RT_TICK_MAX / 2)
if ((t->timeout_tick - timer->timeout_tick) == 0)
{
rt_list_insert_after(n, &(timer->list));
break;
}
else if ((t->timeout_tick - timer->timeout_tick) < RT_TICK_MAX / 2)
{
rt_list_insert_before(n, &(timer->list));
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册