Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
SummerGao.
rt-thread
提交
52d0dc69
R
rt-thread
项目概览
SummerGao.
/
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,发现更多精彩内容 >>
未验证
提交
52d0dc69
编写于
3月 07, 2022
作者:
G
guo
提交者:
GitHub
3月 07, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[kernel]Fixed issue that could all timers stop (#5637)
上级
54219555
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
8 deletion
+17
-8
src/timer.c
src/timer.c
+17
-8
未找到文件。
src/timer.c
浏览文件 @
52d0dc69
...
...
@@ -148,13 +148,15 @@ static void _timer_init(rt_timer_t timer,
*
* @param timer_list is the array of time list
*
* @return the next timer's ticks
* @param timeout_tick is the next timer's ticks
*
* @return Return the operation status. If the return value is RT_EOK, the function is successfully executed.
* If the return value is any other values, it means this operation failed.
*/
static
rt_
tick_t
_timer_list_next_timeout
(
rt_list_t
timer_list
[]
)
static
rt_
err_t
_timer_list_next_timeout
(
rt_list_t
timer_list
[],
rt_tick_t
*
timeout_tick
)
{
struct
rt_timer
*
timer
;
register
rt_base_t
level
;
rt_tick_t
timeout_tick
=
RT_TICK_MAX
;
/* disable interrupt */
level
=
rt_hw_interrupt_disable
();
...
...
@@ -163,13 +165,18 @@ static rt_tick_t _timer_list_next_timeout(rt_list_t timer_list[])
{
timer
=
rt_list_entry
(
timer_list
[
RT_TIMER_SKIP_LIST_LEVEL
-
1
].
next
,
struct
rt_timer
,
row
[
RT_TIMER_SKIP_LIST_LEVEL
-
1
]);
timeout_tick
=
timer
->
timeout_tick
;
*
timeout_tick
=
timer
->
timeout_tick
;
/* enable interrupt */
rt_hw_interrupt_enable
(
level
);
return
RT_EOK
;
}
/* enable interrupt */
rt_hw_interrupt_enable
(
level
);
return
timeout_tick
;
return
-
RT_ERROR
;
}
/**
...
...
@@ -565,6 +572,7 @@ rt_err_t rt_timer_control(rt_timer_t timer, int cmd, void *arg)
break
;
case
RT_TIMER_CTRL_SET_TIME
:
RT_ASSERT
((
*
(
rt_tick_t
*
)
arg
)
<
RT_TICK_MAX
/
2
);
timer
->
init_tick
=
*
(
rt_tick_t
*
)
arg
;
break
;
...
...
@@ -682,7 +690,9 @@ void rt_timer_check(void)
*/
rt_tick_t
rt_timer_next_timeout_tick
(
void
)
{
return
_timer_list_next_timeout
(
_timer_list
);
rt_tick_t
next_timeout
=
RT_TICK_MAX
;
_timer_list_next_timeout
(
_timer_list
,
&
next_timeout
);
return
next_timeout
;
}
#ifdef RT_USING_TIMER_SOFT
...
...
@@ -776,8 +786,7 @@ static void _timer_thread_entry(void *parameter)
while
(
1
)
{
/* get the next timeout tick */
next_timeout
=
_timer_list_next_timeout
(
_soft_timer_list
);
if
(
next_timeout
==
RT_TICK_MAX
)
if
(
_timer_list_next_timeout
(
_soft_timer_list
,
&
next_timeout
)
!=
RT_EOK
)
{
/* no software timer exist, suspend self. */
rt_thread_suspend
(
rt_thread_self
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录