Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
c10678c1
R
rt-thread
项目概览
BaiXuePrincess
/
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,发现更多精彩内容 >>
提交
c10678c1
编写于
7月 13, 2021
作者:
mysterywolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
内部函数以_开头
上级
e7097118
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
60 addition
and
60 deletion
+60
-60
src/idle.c
src/idle.c
+2
-2
src/ipc.c
src/ipc.c
+51
-51
src/scheduler.c
src/scheduler.c
+7
-7
未找到文件。
src/idle.c
浏览文件 @
c10678c1
...
...
@@ -129,7 +129,7 @@ rt_err_t rt_thread_idle_delhook(void (*hook)(void))
#ifdef RT_USING_HEAP
/* Return whether there is defunctional thread to be deleted. */
rt_inline
int
_
rt
_has_defunct_thread
(
void
)
rt_inline
int
_
idle
_has_defunct_thread
(
void
)
{
/* The rt_list_isempty has prototype of "int rt_list_isempty(const rt_list_t *l)".
* So the compiler has a good reason that the rt_thread_defunct list does
...
...
@@ -165,7 +165,7 @@ void rt_thread_idle_excute(void)
lock
=
rt_hw_interrupt_disable
();
/* check whether list is empty */
if
(
!
_
rt
_has_defunct_thread
())
if
(
!
_
idle
_has_defunct_thread
())
{
rt_hw_interrupt_enable
(
lock
);
break
;
...
...
src/ipc.c
浏览文件 @
c10678c1
...
...
@@ -63,7 +63,7 @@ extern void (*rt_object_put_hook)(struct rt_object *object);
*
* @return the operation status, RT_EOK on successful
*/
rt_inline
rt_err_t
_
rt_
ipc_object_init
(
struct
rt_ipc_object
*
ipc
)
rt_inline
rt_err_t
_ipc_object_init
(
struct
rt_ipc_object
*
ipc
)
{
/* initialize ipc object */
rt_list_init
(
&
(
ipc
->
suspend_thread
));
...
...
@@ -82,9 +82,9 @@ rt_inline rt_err_t _rt_ipc_object_init(struct rt_ipc_object *ipc)
*
* @return the operation status, RT_EOK on successful
*/
rt_inline
rt_err_t
_
rt_
ipc_list_suspend
(
rt_list_t
*
list
,
struct
rt_thread
*
thread
,
rt_uint8_t
flag
)
rt_inline
rt_err_t
_ipc_list_suspend
(
rt_list_t
*
list
,
struct
rt_thread
*
thread
,
rt_uint8_t
flag
)
{
/* suspend thread */
rt_thread_suspend
(
thread
);
...
...
@@ -140,7 +140,7 @@ rt_inline rt_err_t _rt_ipc_list_suspend(rt_list_t *list,
*
* @return the operation status, RT_EOK on successful
*/
rt_inline
rt_err_t
_
rt_
ipc_list_resume
(
rt_list_t
*
list
)
rt_inline
rt_err_t
_ipc_list_resume
(
rt_list_t
*
list
)
{
struct
rt_thread
*
thread
;
...
...
@@ -163,7 +163,7 @@ rt_inline rt_err_t _rt_ipc_list_resume(rt_list_t *list)
*
* @return the operation status, RT_EOK on successful
*/
rt_inline
rt_err_t
_
rt_
ipc_list_resume_all
(
rt_list_t
*
list
)
rt_inline
rt_err_t
_ipc_list_resume_all
(
rt_list_t
*
list
)
{
struct
rt_thread
*
thread
;
register
rt_ubase_t
temp
;
...
...
@@ -217,7 +217,7 @@ rt_err_t rt_sem_init(rt_sem_t sem,
rt_object_init
(
&
(
sem
->
parent
.
parent
),
RT_Object_Class_Semaphore
,
name
);
/* initialize ipc object */
_
rt_
ipc_object_init
(
&
(
sem
->
parent
));
_ipc_object_init
(
&
(
sem
->
parent
));
/* set initial value */
sem
->
value
=
(
rt_uint16_t
)
value
;
...
...
@@ -246,7 +246,7 @@ rt_err_t rt_sem_detach(rt_sem_t sem)
RT_ASSERT
(
rt_object_is_systemobject
(
&
sem
->
parent
.
parent
));
/* wakeup all suspended threads */
_
rt_
ipc_list_resume_all
(
&
(
sem
->
parent
.
suspend_thread
));
_ipc_list_resume_all
(
&
(
sem
->
parent
.
suspend_thread
));
/* detach semaphore object */
rt_object_detach
(
&
(
sem
->
parent
.
parent
));
...
...
@@ -280,7 +280,7 @@ rt_sem_t rt_sem_create(const char *name, rt_uint32_t value, rt_uint8_t flag)
return
sem
;
/* initialize ipc object */
_
rt_
ipc_object_init
(
&
(
sem
->
parent
));
_ipc_object_init
(
&
(
sem
->
parent
));
/* set initial value */
sem
->
value
=
value
;
...
...
@@ -311,7 +311,7 @@ rt_err_t rt_sem_delete(rt_sem_t sem)
RT_ASSERT
(
rt_object_is_systemobject
(
&
sem
->
parent
.
parent
)
==
RT_FALSE
);
/* wakeup all suspended threads */
_
rt_
ipc_list_resume_all
(
&
(
sem
->
parent
.
suspend_thread
));
_ipc_list_resume_all
(
&
(
sem
->
parent
.
suspend_thread
));
/* delete semaphore object */
rt_object_delete
(
&
(
sem
->
parent
.
parent
));
...
...
@@ -382,7 +382,7 @@ rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t time)
thread
->
name
));
/* suspend thread */
_
rt_
ipc_list_suspend
(
&
(
sem
->
parent
.
suspend_thread
),
_ipc_list_suspend
(
&
(
sem
->
parent
.
suspend_thread
),
thread
,
sem
->
parent
.
parent
.
flag
);
...
...
@@ -463,7 +463,7 @@ rt_err_t rt_sem_release(rt_sem_t sem)
if
(
!
rt_list_isempty
(
&
sem
->
parent
.
suspend_thread
))
{
/* resume the suspended thread */
_
rt_
ipc_list_resume
(
&
(
sem
->
parent
.
suspend_thread
));
_ipc_list_resume
(
&
(
sem
->
parent
.
suspend_thread
));
need_schedule
=
RT_TRUE
;
}
else
...
...
@@ -517,7 +517,7 @@ rt_err_t rt_sem_control(rt_sem_t sem, int cmd, void *arg)
level
=
rt_hw_interrupt_disable
();
/* resume all waiting thread */
_
rt_
ipc_list_resume_all
(
&
sem
->
parent
.
suspend_thread
);
_ipc_list_resume_all
(
&
sem
->
parent
.
suspend_thread
);
/* set new value */
sem
->
value
=
(
rt_uint16_t
)
value
;
...
...
@@ -555,7 +555,7 @@ rt_err_t rt_mutex_init(rt_mutex_t mutex, const char *name, rt_uint8_t flag)
rt_object_init
(
&
(
mutex
->
parent
.
parent
),
RT_Object_Class_Mutex
,
name
);
/* initialize ipc object */
_
rt_
ipc_object_init
(
&
(
mutex
->
parent
));
_ipc_object_init
(
&
(
mutex
->
parent
));
mutex
->
value
=
1
;
mutex
->
owner
=
RT_NULL
;
...
...
@@ -586,7 +586,7 @@ rt_err_t rt_mutex_detach(rt_mutex_t mutex)
RT_ASSERT
(
rt_object_is_systemobject
(
&
mutex
->
parent
.
parent
));
/* wakeup all suspended threads */
_
rt_
ipc_list_resume_all
(
&
(
mutex
->
parent
.
suspend_thread
));
_ipc_list_resume_all
(
&
(
mutex
->
parent
.
suspend_thread
));
/* detach semaphore object */
rt_object_detach
(
&
(
mutex
->
parent
.
parent
));
...
...
@@ -618,7 +618,7 @@ rt_mutex_t rt_mutex_create(const char *name, rt_uint8_t flag)
return
mutex
;
/* initialize ipc object */
_
rt_
ipc_object_init
(
&
(
mutex
->
parent
));
_ipc_object_init
(
&
(
mutex
->
parent
));
mutex
->
value
=
1
;
mutex
->
owner
=
RT_NULL
;
...
...
@@ -651,7 +651,7 @@ rt_err_t rt_mutex_delete(rt_mutex_t mutex)
RT_ASSERT
(
rt_object_is_systemobject
(
&
mutex
->
parent
.
parent
)
==
RT_FALSE
);
/* wakeup all suspended threads */
_
rt_
ipc_list_resume_all
(
&
(
mutex
->
parent
.
suspend_thread
));
_ipc_list_resume_all
(
&
(
mutex
->
parent
.
suspend_thread
));
/* delete mutex object */
rt_object_delete
(
&
(
mutex
->
parent
.
parent
));
...
...
@@ -765,7 +765,7 @@ __again:
}
/* suspend current thread */
_
rt_
ipc_list_suspend
(
&
(
mutex
->
parent
.
suspend_thread
),
_ipc_list_suspend
(
&
(
mutex
->
parent
.
suspend_thread
),
thread
,
mutex
->
parent
.
parent
.
flag
);
...
...
@@ -916,7 +916,7 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex)
}
/* resume thread */
_
rt_
ipc_list_resume
(
&
(
mutex
->
parent
.
suspend_thread
));
_ipc_list_resume
(
&
(
mutex
->
parent
.
suspend_thread
));
need_schedule
=
RT_TRUE
;
}
...
...
@@ -993,7 +993,7 @@ rt_err_t rt_event_init(rt_event_t event, const char *name, rt_uint8_t flag)
event
->
parent
.
parent
.
flag
=
flag
;
/* initialize ipc object */
_
rt_
ipc_object_init
(
&
(
event
->
parent
));
_ipc_object_init
(
&
(
event
->
parent
));
/* initialize event */
event
->
set
=
0
;
...
...
@@ -1017,7 +1017,7 @@ rt_err_t rt_event_detach(rt_event_t event)
RT_ASSERT
(
rt_object_is_systemobject
(
&
event
->
parent
.
parent
));
/* resume all suspended thread */
_
rt_
ipc_list_resume_all
(
&
(
event
->
parent
.
suspend_thread
));
_ipc_list_resume_all
(
&
(
event
->
parent
.
suspend_thread
));
/* detach event object */
rt_object_detach
(
&
(
event
->
parent
.
parent
));
...
...
@@ -1050,7 +1050,7 @@ rt_event_t rt_event_create(const char *name, rt_uint8_t flag)
event
->
parent
.
parent
.
flag
=
flag
;
/* initialize ipc object */
_
rt_
ipc_object_init
(
&
(
event
->
parent
));
_ipc_object_init
(
&
(
event
->
parent
));
/* initialize event */
event
->
set
=
0
;
...
...
@@ -1076,7 +1076,7 @@ rt_err_t rt_event_delete(rt_event_t event)
RT_DEBUG_NOT_IN_INTERRUPT
;
/* resume all suspended thread */
_
rt_
ipc_list_resume_all
(
&
(
event
->
parent
.
suspend_thread
));
_ipc_list_resume_all
(
&
(
event
->
parent
.
suspend_thread
));
/* delete event object */
rt_object_delete
(
&
(
event
->
parent
.
parent
));
...
...
@@ -1279,7 +1279,7 @@ rt_err_t rt_event_recv(rt_event_t event,
thread
->
event_info
=
option
;
/* put thread to suspended thread list */
_
rt_
ipc_list_suspend
(
&
(
event
->
parent
.
suspend_thread
),
_ipc_list_suspend
(
&
(
event
->
parent
.
suspend_thread
),
thread
,
event
->
parent
.
parent
.
flag
);
...
...
@@ -1345,7 +1345,7 @@ rt_err_t rt_event_control(rt_event_t event, int cmd, void *arg)
level
=
rt_hw_interrupt_disable
();
/* resume all waiting thread */
_
rt_
ipc_list_resume_all
(
&
event
->
parent
.
suspend_thread
);
_ipc_list_resume_all
(
&
event
->
parent
.
suspend_thread
);
/* initialize event set */
event
->
set
=
0
;
...
...
@@ -1391,7 +1391,7 @@ rt_err_t rt_mb_init(rt_mailbox_t mb,
mb
->
parent
.
parent
.
flag
=
flag
;
/* initialize ipc object */
_
rt_
ipc_object_init
(
&
(
mb
->
parent
));
_ipc_object_init
(
&
(
mb
->
parent
));
/* initialize mailbox */
mb
->
msg_pool
=
(
rt_ubase_t
*
)
msgpool
;
...
...
@@ -1422,9 +1422,9 @@ rt_err_t rt_mb_detach(rt_mailbox_t mb)
RT_ASSERT
(
rt_object_is_systemobject
(
&
mb
->
parent
.
parent
));
/* resume all suspended thread */
_
rt_
ipc_list_resume_all
(
&
(
mb
->
parent
.
suspend_thread
));
_ipc_list_resume_all
(
&
(
mb
->
parent
.
suspend_thread
));
/* also resume all mailbox private suspended thread */
_
rt_
ipc_list_resume_all
(
&
(
mb
->
suspend_sender_thread
));
_ipc_list_resume_all
(
&
(
mb
->
suspend_sender_thread
));
/* detach mailbox object */
rt_object_detach
(
&
(
mb
->
parent
.
parent
));
...
...
@@ -1458,7 +1458,7 @@ rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag)
mb
->
parent
.
parent
.
flag
=
flag
;
/* initialize ipc object */
_
rt_
ipc_object_init
(
&
(
mb
->
parent
));
_ipc_object_init
(
&
(
mb
->
parent
));
/* initialize mailbox */
mb
->
size
=
size
;
...
...
@@ -1498,10 +1498,10 @@ rt_err_t rt_mb_delete(rt_mailbox_t mb)
RT_ASSERT
(
rt_object_is_systemobject
(
&
mb
->
parent
.
parent
)
==
RT_FALSE
);
/* resume all suspended thread */
_
rt_
ipc_list_resume_all
(
&
(
mb
->
parent
.
suspend_thread
));
_ipc_list_resume_all
(
&
(
mb
->
parent
.
suspend_thread
));
/* also resume all mailbox private suspended thread */
_
rt_
ipc_list_resume_all
(
&
(
mb
->
suspend_sender_thread
));
_ipc_list_resume_all
(
&
(
mb
->
suspend_sender_thread
));
/* free mailbox pool */
RT_KERNEL_FREE
(
mb
->
msg_pool
);
...
...
@@ -1570,7 +1570,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
RT_DEBUG_IN_THREAD_CONTEXT
;
/* suspend current thread */
_
rt_
ipc_list_suspend
(
&
(
mb
->
suspend_sender_thread
),
_ipc_list_suspend
(
&
(
mb
->
suspend_sender_thread
),
thread
,
mb
->
parent
.
parent
.
flag
);
...
...
@@ -1637,7 +1637,7 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
/* resume suspended thread */
if
(
!
rt_list_isempty
(
&
mb
->
parent
.
suspend_thread
))
{
_
rt_
ipc_list_resume
(
&
(
mb
->
parent
.
suspend_thread
));
_ipc_list_resume
(
&
(
mb
->
parent
.
suspend_thread
));
/* enable interrupt */
rt_hw_interrupt_enable
(
temp
);
...
...
@@ -1718,7 +1718,7 @@ rt_err_t rt_mb_urgent(rt_mailbox_t mb, rt_ubase_t value)
/* resume suspended thread */
if
(
!
rt_list_isempty
(
&
mb
->
parent
.
suspend_thread
))
{
_
rt_
ipc_list_resume
(
&
(
mb
->
parent
.
suspend_thread
));
_ipc_list_resume
(
&
(
mb
->
parent
.
suspend_thread
));
/* enable interrupt */
rt_hw_interrupt_enable
(
temp
);
...
...
@@ -1792,7 +1792,7 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
RT_DEBUG_IN_THREAD_CONTEXT
;
/* suspend current thread */
_
rt_
ipc_list_suspend
(
&
(
mb
->
parent
.
suspend_thread
),
_ipc_list_suspend
(
&
(
mb
->
parent
.
suspend_thread
),
thread
,
mb
->
parent
.
parent
.
flag
);
...
...
@@ -1855,7 +1855,7 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout)
/* resume suspended thread */
if
(
!
rt_list_isempty
(
&
(
mb
->
suspend_sender_thread
)))
{
_
rt_
ipc_list_resume
(
&
(
mb
->
suspend_sender_thread
));
_ipc_list_resume
(
&
(
mb
->
suspend_sender_thread
));
/* enable interrupt */
rt_hw_interrupt_enable
(
temp
);
...
...
@@ -1899,9 +1899,9 @@ rt_err_t rt_mb_control(rt_mailbox_t mb, int cmd, void *arg)
level
=
rt_hw_interrupt_disable
();
/* resume all waiting thread */
_
rt_
ipc_list_resume_all
(
&
(
mb
->
parent
.
suspend_thread
));
_ipc_list_resume_all
(
&
(
mb
->
parent
.
suspend_thread
));
/* also resume all mailbox private suspended thread */
_
rt_
ipc_list_resume_all
(
&
(
mb
->
suspend_sender_thread
));
_ipc_list_resume_all
(
&
(
mb
->
suspend_sender_thread
));
/* re-init mailbox */
mb
->
entry
=
0
;
...
...
@@ -1960,7 +1960,7 @@ rt_err_t rt_mq_init(rt_mq_t mq,
mq
->
parent
.
parent
.
flag
=
flag
;
/* initialize ipc object */
_
rt_
ipc_object_init
(
&
(
mq
->
parent
));
_ipc_object_init
(
&
(
mq
->
parent
));
/* set message pool */
mq
->
msg_pool
=
msgpool
;
...
...
@@ -2008,9 +2008,9 @@ rt_err_t rt_mq_detach(rt_mq_t mq)
RT_ASSERT
(
rt_object_is_systemobject
(
&
mq
->
parent
.
parent
));
/* resume all suspended thread */
_
rt_
ipc_list_resume_all
(
&
mq
->
parent
.
suspend_thread
);
_ipc_list_resume_all
(
&
mq
->
parent
.
suspend_thread
);
/* also resume all message queue private suspended thread */
_
rt_
ipc_list_resume_all
(
&
(
mq
->
suspend_sender_thread
));
_ipc_list_resume_all
(
&
(
mq
->
suspend_sender_thread
));
/* detach message queue object */
rt_object_detach
(
&
(
mq
->
parent
.
parent
));
...
...
@@ -2050,7 +2050,7 @@ rt_mq_t rt_mq_create(const char *name,
mq
->
parent
.
parent
.
flag
=
flag
;
/* initialize ipc object */
_
rt_
ipc_object_init
(
&
(
mq
->
parent
));
_ipc_object_init
(
&
(
mq
->
parent
));
/* initialize message queue */
...
...
@@ -2108,9 +2108,9 @@ rt_err_t rt_mq_delete(rt_mq_t mq)
RT_ASSERT
(
rt_object_is_systemobject
(
&
mq
->
parent
.
parent
)
==
RT_FALSE
);
/* resume all suspended thread */
_
rt_
ipc_list_resume_all
(
&
(
mq
->
parent
.
suspend_thread
));
_ipc_list_resume_all
(
&
(
mq
->
parent
.
suspend_thread
));
/* also resume all message queue private suspended thread */
_
rt_
ipc_list_resume_all
(
&
(
mq
->
suspend_sender_thread
));
_ipc_list_resume_all
(
&
(
mq
->
suspend_sender_thread
));
/* free message queue pool */
RT_KERNEL_FREE
(
mq
->
msg_pool
);
...
...
@@ -2192,7 +2192,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
RT_DEBUG_IN_THREAD_CONTEXT
;
/* suspend current thread */
_
rt_
ipc_list_suspend
(
&
(
mq
->
suspend_sender_thread
),
_ipc_list_suspend
(
&
(
mq
->
suspend_sender_thread
),
thread
,
mq
->
parent
.
parent
.
flag
);
...
...
@@ -2278,7 +2278,7 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq,
/* resume suspended thread */
if
(
!
rt_list_isempty
(
&
mq
->
parent
.
suspend_thread
))
{
_
rt_
ipc_list_resume
(
&
(
mq
->
parent
.
suspend_thread
));
_ipc_list_resume
(
&
(
mq
->
parent
.
suspend_thread
));
/* enable interrupt */
rt_hw_interrupt_enable
(
temp
);
...
...
@@ -2386,7 +2386,7 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, const void *buffer, rt_size_t size)
/* resume suspended thread */
if
(
!
rt_list_isempty
(
&
mq
->
parent
.
suspend_thread
))
{
_
rt_
ipc_list_resume
(
&
(
mq
->
parent
.
suspend_thread
));
_ipc_list_resume
(
&
(
mq
->
parent
.
suspend_thread
));
/* enable interrupt */
rt_hw_interrupt_enable
(
temp
);
...
...
@@ -2468,7 +2468,7 @@ rt_err_t rt_mq_recv(rt_mq_t mq,
}
/* suspend current thread */
_
rt_
ipc_list_suspend
(
&
(
mq
->
parent
.
suspend_thread
),
_ipc_list_suspend
(
&
(
mq
->
parent
.
suspend_thread
),
thread
,
mq
->
parent
.
parent
.
flag
);
...
...
@@ -2544,7 +2544,7 @@ rt_err_t rt_mq_recv(rt_mq_t mq,
/* resume suspended thread */
if
(
!
rt_list_isempty
(
&
(
mq
->
suspend_sender_thread
)))
{
_
rt_
ipc_list_resume
(
&
(
mq
->
suspend_sender_thread
));
_ipc_list_resume
(
&
(
mq
->
suspend_sender_thread
));
/* enable interrupt */
rt_hw_interrupt_enable
(
temp
);
...
...
@@ -2590,9 +2590,9 @@ rt_err_t rt_mq_control(rt_mq_t mq, int cmd, void *arg)
level
=
rt_hw_interrupt_disable
();
/* resume all waiting thread */
_
rt_
ipc_list_resume_all
(
&
mq
->
parent
.
suspend_thread
);
_ipc_list_resume_all
(
&
mq
->
parent
.
suspend_thread
);
/* also resume all message queue private suspended thread */
_
rt_
ipc_list_resume_all
(
&
(
mq
->
suspend_sender_thread
));
_ipc_list_resume_all
(
&
(
mq
->
suspend_sender_thread
));
/* release all message in the queue */
while
(
mq
->
msg_queue_head
!=
RT_NULL
)
...
...
src/scheduler.c
浏览文件 @
c10678c1
...
...
@@ -23,7 +23,7 @@
* 2013-12-21 Grissiom add rt_critical_level
* 2018-11-22 Jesven remove the current task from ready queue
* add per cpu ready queue
* add _
rt
_get_highest_priority_thread to find highest priority task
* add _
scheduler
_get_highest_priority_thread to find highest priority task
* rt_schedule_insert_thread won't insert current task to ready queue
* in smp version, rt_hw_context_switch_interrupt maybe switch to
* new task directly
...
...
@@ -114,7 +114,7 @@ static void _rt_scheduler_stack_check(struct rt_thread *thread)
* get the highest priority thread in ready queue
*/
#ifdef RT_USING_SMP
static
struct
rt_thread
*
_
rt
_get_highest_priority_thread
(
rt_ubase_t
*
highest_prio
)
static
struct
rt_thread
*
_
scheduler
_get_highest_priority_thread
(
rt_ubase_t
*
highest_prio
)
{
register
struct
rt_thread
*
highest_priority_thread
;
register
rt_ubase_t
highest_ready_priority
,
local_highest_ready_priority
;
...
...
@@ -150,7 +150,7 @@ static struct rt_thread* _rt_get_highest_priority_thread(rt_ubase_t *highest_pri
return
highest_priority_thread
;
}
#else
static
struct
rt_thread
*
_
rt
_get_highest_priority_thread
(
rt_ubase_t
*
highest_prio
)
static
struct
rt_thread
*
_
scheduler
_get_highest_priority_thread
(
rt_ubase_t
*
highest_prio
)
{
register
struct
rt_thread
*
highest_priority_thread
;
register
rt_ubase_t
highest_ready_priority
;
...
...
@@ -239,7 +239,7 @@ void rt_system_scheduler_start(void)
register
struct
rt_thread
*
to_thread
;
rt_ubase_t
highest_ready_priority
;
to_thread
=
_
rt
_get_highest_priority_thread
(
&
highest_ready_priority
);
to_thread
=
_
scheduler
_get_highest_priority_thread
(
&
highest_ready_priority
);
#ifdef RT_USING_SMP
to_thread
->
oncpu
=
rt_hw_cpu_id
();
...
...
@@ -327,7 +327,7 @@ void rt_schedule(void)
if
(
rt_thread_ready_priority_group
!=
0
||
pcpu
->
priority_group
!=
0
)
{
to_thread
=
_
rt
_get_highest_priority_thread
(
&
highest_ready_priority
);
to_thread
=
_
scheduler
_get_highest_priority_thread
(
&
highest_ready_priority
);
current_thread
->
oncpu
=
RT_CPU_DETACHED
;
if
((
current_thread
->
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_RUNNING
)
{
...
...
@@ -425,7 +425,7 @@ void rt_schedule(void)
/* need_insert_from_thread: need to insert from_thread to ready queue */
int
need_insert_from_thread
=
0
;
to_thread
=
_
rt
_get_highest_priority_thread
(
&
highest_ready_priority
);
to_thread
=
_
scheduler
_get_highest_priority_thread
(
&
highest_ready_priority
);
if
((
rt_current_thread
->
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_RUNNING
)
{
...
...
@@ -576,7 +576,7 @@ void rt_scheduler_do_irq_switch(void *context)
if
(
rt_thread_ready_priority_group
!=
0
||
pcpu
->
priority_group
!=
0
)
{
to_thread
=
_
rt
_get_highest_priority_thread
(
&
highest_ready_priority
);
to_thread
=
_
scheduler
_get_highest_priority_thread
(
&
highest_ready_priority
);
current_thread
->
oncpu
=
RT_CPU_DETACHED
;
if
((
current_thread
->
stat
&
RT_THREAD_STAT_MASK
)
==
RT_THREAD_RUNNING
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录