Skip to content

idle线程主动挂起行为是何用意呢? #8446

Description

@daguobayern

最新master分支上的idle.c文件中的rt_defunct_execute函数,该函数中有如下代码

        while (rt_atomic_load(&(thread->ref_count)))
        {
            rt_thread_delay(5);
        }

问题:

1,此处循环原子读ref_count是想达到什么目的呢,在idle线程初始化里面ref_count初始化为0,所以不会进入该循环,这里正确用法是什么呢,若此值非0,是不是在其他线程里面会一直减这个ref_count呢?
2,非0情况下,idle线程就主动sleep,这里不是就挂起idle线程了吗,idle是允许被挂起的吧

Metadata

Metadata

Assignees

Labels

bugThis PR/issue is a bug in the current code.

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