Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
缘_顺
rt-thread
提交
806eb49f
R
rt-thread
项目概览
缘_顺
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
806eb49f
编写于
1月 24, 2019
作者:
B
Bernard Xiong
提交者:
GitHub
1月 24, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2259 from RT-Thread/fix_thread_stat
[Kernel] Fix rt_schedule_insert_thread issue
上级
a68bdc94
69994ca2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
10 deletion
+14
-10
src/scheduler.c
src/scheduler.c
+14
-10
未找到文件。
src/scheduler.c
浏览文件 @
806eb49f
...
...
@@ -351,7 +351,7 @@ void rt_schedule(void)
RT_OBJECT_HOOK_CALL
(
rt_scheduler_hook
,
(
current_thread
,
to_thread
));
rt_schedule_remove_thread
(
to_thread
);
to_thread
->
stat
=
RT_THREAD_RUNNING
;
to_thread
->
stat
=
RT_THREAD_RUNNING
|
(
to_thread
->
stat
&
~
RT_THREAD_STAT_MASK
)
;
/* switch to new thread */
RT_DEBUG_LOG
(
RT_DEBUG_SCHEDULER
,
...
...
@@ -412,6 +412,7 @@ void rt_schedule(void)
if
(
rt_thread_ready_priority_group
!=
0
)
{
/* need_insert_from_thread: need to insert from_thread to ready queue */
int
need_insert_from_thread
=
0
;
to_thread
=
_get_highest_priority_thread
(
&
highest_ready_priority
);
...
...
@@ -443,7 +444,7 @@ void rt_schedule(void)
}
rt_schedule_remove_thread
(
to_thread
);
to_thread
->
stat
=
RT_THREAD_RUNNING
;
to_thread
->
stat
=
RT_THREAD_RUNNING
|
(
to_thread
->
stat
&
~
RT_THREAD_STAT_MASK
)
;
/* switch to new thread */
RT_DEBUG_LOG
(
RT_DEBUG_SCHEDULER
,
...
...
@@ -485,7 +486,7 @@ void rt_schedule(void)
else
{
rt_schedule_remove_thread
(
rt_current_thread
);
rt_current_thread
->
stat
=
RT_THREAD_RUNNING
;
rt_current_thread
->
stat
=
RT_THREAD_RUNNING
|
(
rt_current_thread
->
stat
&
~
RT_THREAD_STAT_MASK
)
;
}
}
}
...
...
@@ -556,7 +557,7 @@ void rt_scheduler_do_irq_switch(void *context)
RT_OBJECT_HOOK_CALL
(
rt_scheduler_hook
,
(
current_thread
,
to_thread
));
rt_schedule_remove_thread
(
to_thread
);
to_thread
->
stat
=
RT_THREAD_RUNNING
;
to_thread
->
stat
=
RT_THREAD_RUNNING
|
(
to_thread
->
stat
&
~
RT_THREAD_STAT_MASK
)
;
#ifdef RT_USING_OVERFLOW_CHECK
_rt_scheduler_stack_check
(
to_thread
);
...
...
@@ -595,14 +596,16 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
/* disable interrupt */
level
=
rt_hw_interrupt_disable
();
/* change stat */
thread
->
stat
=
RT_THREAD_READY
|
(
thread
->
stat
&
~
RT_THREAD_STAT_MASK
);
/* it should be RUNNING thread */
if
(
thread
->
oncpu
!=
RT_CPU_DETACHED
)
{
thread
->
stat
=
RT_THREAD_RUNNING
|
(
thread
->
stat
&
~
RT_THREAD_STAT_MASK
);
goto
__exit
;
}
/* READY thread, insert to ready queue */
thread
->
stat
=
RT_THREAD_READY
|
(
thread
->
stat
&
~
RT_THREAD_STAT_MASK
);
cpu_id
=
rt_hw_cpu_id
();
bind_cpu
=
thread
->
bind_cpu
;
...
...
@@ -655,14 +658,15 @@ void rt_schedule_insert_thread(struct rt_thread *thread)
/* disable interrupt */
temp
=
rt_hw_interrupt_disable
();
/* change stat */
thread
->
stat
=
RT_THREAD_READY
|
(
thread
->
stat
&
~
RT_THREAD_STAT_MASK
);
/* it's current thread, it should be RUNNING thread */
if
(
thread
==
rt_current_thread
)
{
thread
->
stat
=
RT_THREAD_RUNNING
|
(
thread
->
stat
&
~
RT_THREAD_STAT_MASK
);
goto
__exit
;
}
/* READY thread, insert to ready queue */
thread
->
stat
=
RT_THREAD_READY
|
(
thread
->
stat
&
~
RT_THREAD_STAT_MASK
);
/* insert thread to ready list */
rt_list_insert_before
(
&
(
rt_thread_priority_table
[
thread
->
current_priority
]),
&
(
thread
->
tlist
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录