Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

[src] fix mutex bug #10050

wants to merge 2 commits into from

Conversation

wycwyhwyq
Copy link
Contributor

@wycwyhwyq wycwyhwyq commented Feb 27, 2025

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

#10049

你的解决方案是什么 (what is your solution)

请提供验证的bsp和config (provide the config and bsp)

  • BSP:
    risc-v/K230
  • .config:
  • action:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/workflows/bsp_buildings.yml 详细请参考链接BSP自查

@github-actions github-actions bot added the Kernel PR has src relate code label Feb 27, 2025
@@ -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);
Copy link
Member

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 基础上修改呢?

Copy link
Contributor Author

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

Copy link
Member

@Rbb666 Rbb666 Mar 12, 2025

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的选项

Copy link
Contributor Author

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. */

Copy link
Member

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. */

可以

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

@wycwyhwyq wycwyhwyq requested a review from BernardXiong as a code owner March 12, 2025 10:17
@github-actions github-actions bot added RT-Smart RT-Thread Smart related PR or issues component: lwp Component labels Mar 12, 2025
@mysterywolf
Copy link
Member

change prio 和 set prio这两个函数有什么区别呀,这个名字没有注释的话很不好区分

@wycwyhwyq
Copy link
Contributor Author

wycwyhwyq commented Mar 13, 2025

change prio 和 set prio这两个函数有什么区别呀,这个名字没有注释的话很不好区分

关于函数名字和注释,你们可以协商定一个告诉我或者直接修改。

@wycwyhwyq wycwyhwyq closed this Mar 13, 2025
@wycwyhwyq wycwyhwyq reopened this Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: lwp Component Kernel PR has src relate code RT-Smart RT-Thread Smart related PR or issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants