[ktime] quality: remove recursion on hrtimer (#9110)
[ktime] feat: remove recursion on hrtimer Replace recursive algorithm with a loop in hrtimer when determining next timeout event and setup hr timer. Signed-off-by: Shell <smokewood@qq.com>
This commit is contained in:
parent
b79d5013ff
commit
3d8c27bcc9
|
@ -146,20 +146,26 @@ static void _set_next_timeout_locked(void)
|
||||||
{
|
{
|
||||||
rt_ktime_hrtimer_t timer;
|
rt_ktime_hrtimer_t timer;
|
||||||
rt_ubase_t next_timeout_hrtimer_cnt;
|
rt_ubase_t next_timeout_hrtimer_cnt;
|
||||||
|
rt_bool_t find_next;
|
||||||
|
|
||||||
if ((timer = _first_hrtimer()) != RT_NULL)
|
do
|
||||||
{
|
{
|
||||||
next_timeout_hrtimer_cnt = _cnt_convert(timer->timeout_cnt);
|
find_next = RT_FALSE;
|
||||||
if (next_timeout_hrtimer_cnt > 0)
|
if ((timer = _first_hrtimer()) != RT_NULL)
|
||||||
{
|
{
|
||||||
rt_ktime_hrtimer_settimeout(next_timeout_hrtimer_cnt);
|
next_timeout_hrtimer_cnt = _cnt_convert(timer->timeout_cnt);
|
||||||
}
|
if (next_timeout_hrtimer_cnt > 0)
|
||||||
else
|
{
|
||||||
{
|
rt_ktime_hrtimer_settimeout(next_timeout_hrtimer_cnt);
|
||||||
_hrtimer_process_locked();
|
}
|
||||||
_set_next_timeout_locked();
|
else
|
||||||
|
{
|
||||||
|
_hrtimer_process_locked();
|
||||||
|
find_next = RT_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
while (find_next);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rt_ktime_hrtimer_process(void)
|
void rt_ktime_hrtimer_process(void)
|
||||||
|
|
Loading…
Reference in New Issue