Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lfmiao0
rt-thread
提交
de624c52
R
rt-thread
项目概览
lfmiao0
/
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,发现更多精彩内容 >>
提交
de624c52
编写于
1月 13, 2019
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Kernel] Enable RUNNING status in thread.
上级
83b67ec3
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
19 addition
and
10 deletion
+19
-10
src/scheduler.c
src/scheduler.c
+9
-4
src/thread.c
src/thread.c
+9
-5
src/timer.c
src/timer.c
+1
-1
未找到文件。
src/scheduler.c
浏览文件 @
de624c52
...
...
@@ -265,6 +265,7 @@ void rt_system_scheduler_start(void)
#endif
/*RT_USING_SMP*/
rt_schedule_remove_thread
(
to_thread
);
to_thread
->
stat
=
RT_THREAD_RUNNING
;
/* switch to new thread */
#ifdef RT_USING_SMP
...
...
@@ -330,7 +331,7 @@ void rt_schedule(void)
{
to_thread
=
_get_highest_priority_thread
(
&
highest_ready_priority
);
current_thread
->
oncpu
=
RT_CPU_DETACHED
;
if
((
current_thread
->
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_R
EADY
)
if
((
current_thread
->
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_R
UNNING
)
{
if
(
current_thread
->
current_priority
<
highest_ready_priority
)
{
...
...
@@ -350,6 +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
;
/* switch to new thread */
RT_DEBUG_LOG
(
RT_DEBUG_SCHEDULER
,
...
...
@@ -414,7 +416,7 @@ void rt_schedule(void)
to_thread
=
_get_highest_priority_thread
(
&
highest_ready_priority
);
if
((
rt_current_thread
->
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_R
EADY
)
if
((
rt_current_thread
->
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_R
UNNING
)
{
if
(
rt_current_thread
->
current_priority
<
highest_ready_priority
)
{
...
...
@@ -441,6 +443,7 @@ void rt_schedule(void)
}
rt_schedule_remove_thread
(
to_thread
);
to_thread
->
stat
=
RT_THREAD_RUNNING
;
/* switch to new thread */
RT_DEBUG_LOG
(
RT_DEBUG_SCHEDULER
,
...
...
@@ -482,6 +485,7 @@ void rt_schedule(void)
else
{
rt_schedule_remove_thread
(
rt_current_thread
);
rt_current_thread
->
stat
=
RT_THREAD_RUNNING
;
}
}
}
...
...
@@ -531,7 +535,7 @@ void rt_scheduler_do_irq_switch(void *context)
{
to_thread
=
_get_highest_priority_thread
(
&
highest_ready_priority
);
current_thread
->
oncpu
=
RT_CPU_DETACHED
;
if
((
current_thread
->
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_R
EADY
)
if
((
current_thread
->
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_R
UNNING
)
{
if
(
current_thread
->
current_priority
<
highest_ready_priority
)
{
...
...
@@ -552,6 +556,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
;
#ifdef RT_USING_OVERFLOW_CHECK
_rt_scheduler_stack_check
(
to_thread
);
...
...
src/thread.c
浏览文件 @
de624c52
...
...
@@ -655,6 +655,7 @@ RTM_EXPORT(rt_thread_control);
*/
rt_err_t
rt_thread_suspend
(
rt_thread_t
thread
)
{
register
rt_base_t
stat
;
register
rt_base_t
temp
;
/* thread check */
...
...
@@ -663,22 +664,25 @@ rt_err_t rt_thread_suspend(rt_thread_t thread)
RT_DEBUG_LOG
(
RT_DEBUG_THREAD
,
(
"thread suspend: %s
\n
"
,
thread
->
name
));
if
((
thread
->
stat
&
RT_THREAD_STAT_MASK
)
!=
RT_THREAD_READY
)
stat
=
thread
->
stat
&
RT_THREAD_STAT_MASK
;
if
((
stat
!=
RT_THREAD_READY
)
&&
(
stat
!=
RT_THREAD_RUNNING
))
{
RT_DEBUG_LOG
(
RT_DEBUG_THREAD
,
(
"thread suspend: thread disorder, 0x%2x
\n
"
,
thread
->
stat
));
return
-
RT_ERROR
;
}
RT_ASSERT
(
thread
==
rt_thread_self
());
/* disable interrupt */
temp
=
rt_hw_interrupt_disable
();
if
(
stat
==
RT_THREAD_RUNNING
)
{
/* not suspend running status thread on other core */
RT_ASSERT
(
thread
==
rt_thread_self
());
}
/* change thread stat */
thread
->
stat
=
RT_THREAD_SUSPEND
|
(
thread
->
stat
&
~
RT_THREAD_STAT_MASK
);
rt_schedule_remove_thread
(
thread
);
thread
->
stat
=
RT_THREAD_SUSPEND
|
(
thread
->
stat
&
~
RT_THREAD_STAT_MASK
);
/* stop thread timer anyway */
rt_timer_stop
(
&
(
thread
->
thread_timer
));
...
...
src/timer.c
浏览文件 @
de624c52
...
...
@@ -399,7 +399,7 @@ rt_err_t rt_timer_start(rt_timer_t timer)
if
(
timer
->
parent
.
flag
&
RT_TIMER_FLAG_SOFT_TIMER
)
{
/* check whether timer thread is ready */
if
((
timer_thread
.
stat
&
RT_THREAD_STAT_MASK
)
!=
RT_THREAD_READY
)
if
((
timer_thread
.
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_SUSPEND
)
{
/* resume timer thread to check soft timer */
rt_thread_resume
(
&
timer_thread
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录