-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[src] fix mutex bug #10050
base: master
Are you sure you want to change the base?
[src] fix mutex bug #10050
Conversation
@@ -797,7 +797,7 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg) | |||
rt_err_t error; | |||
rt_sched_lock_level_t slvl; | |||
rt_sched_lock(&slvl); | |||
error = rt_sched_thread_change_priority(thread, *(rt_uint8_t *)arg); | |||
error = rt_sched_thread_set_priority(thread, *(rt_uint8_t *)arg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个API为什么不直接在 rt_sched_thread_change_priority
基础上修改呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个API为什么不直接在
rt_sched_thread_change_priority
基础上修改呢?
原API还有其它地方在调用,如_thread_update_priority
、_check_and_update_prio
,这些地方不能调整init_priority
。我理解init_priority
用于设置task的正常优先级,而current_priority
可能会因为使用mutex改变,是临时优先级,当使用完mutex后task会返回到init_priority
。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个API为什么不直接在
rt_sched_thread_change_priority
基础上修改呢?
原API还有其它地方在调用,如_thread_update_priority
、_check_and_update_prio
,这些地方不能调整init_priority
。我理解init_priority
用于设置task的正常优先级,而current_priority
可能会因为使用mutex改变,是临时优先级,当使用完mutex后task会返回到init_priority
。
建议在rt_thread_control
中新增一个:RT_THREAD_CTRL_SET_PRIORITY
的选项
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议在
rt_thread_control
中新增一个:RT_THREAD_CTRL_SET_PRIORITY
的选项
新增涉及到更改rtdef.h
,请为RT_THREAD_CTRL_SET_PRIORITY
提供一个合适值,0x05?
#define RT_THREAD_CTRL_STARTUP 0x00 /**< Startup thread. */
#define RT_THREAD_CTRL_CLOSE 0x01 /**< Close thread. */
#define RT_THREAD_CTRL_CHANGE_PRIORITY 0x02 /**< Change thread priority. */
#define RT_THREAD_CTRL_INFO 0x03 /**< Get thread information. */
#define RT_THREAD_CTRL_BIND_CPU 0x04 /**< Set thread bind cpu. */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议在
rt_thread_control
中新增一个:RT_THREAD_CTRL_SET_PRIORITY
的选项新增涉及到更改
rtdef.h
,请为RT_THREAD_CTRL_SET_PRIORITY
提供一个合适值,0x05?#define RT_THREAD_CTRL_STARTUP 0x00 /**< Startup thread. */ #define RT_THREAD_CTRL_CLOSE 0x01 /**< Close thread. */ #define RT_THREAD_CTRL_CHANGE_PRIORITY 0x02 /**< Change thread priority. */ #define RT_THREAD_CTRL_INFO 0x03 /**< Get thread information. */ #define RT_THREAD_CTRL_BIND_CPU 0x04 /**< Set thread bind cpu. */
可以
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
change prio 和 set prio这两个函数有什么区别呀,这个名字没有注释的话很不好区分 |
关于函数名字和注释,你们可以协商定一个告诉我或者直接修改。 |
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
#10049
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
risc-v/K230
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0
代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up