Skip to content

softtimer BUG记录 #3817

Description

@geniusgogo

rt-thread/src/timer.c

Lines 609 to 628 in d463a5a

n != &(rt_soft_timer_list[RT_TIMER_SKIP_LIST_LEVEL - 1]);)
{
t = rt_list_entry(n, struct rt_timer, row[RT_TIMER_SKIP_LIST_LEVEL - 1]);
/*
* It supposes that the new tick shall less than the half duration of
* tick max.
*/
if ((current_tick - t->timeout_tick) < RT_TICK_MAX / 2)
{
RT_OBJECT_HOOK_CALL(rt_timer_enter_hook, (t));
/* move node to the next */
n = n->next;
/* remove timer from timer list firstly */
_rt_timer_remove(t);
/* not lock scheduler when performing timeout function */
rt_exit_critical();

由于这里的list遍历会出现严重的迭代失效问题,导致softtimer任务死循环。
正确的处理方式应该和系统timerlist一致。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions