summaryrefslogtreecommitdiff
path: root/src/thread.c
AgeCommit message (Collapse)Author
2026-08-21[kernel][ipc] Fix timeout wakeup ownership raceari.liu
Keep thread timer ownership when timer stop races with an in-flight timeout callback, and consume IPC resources only after a waiter is resumed successfully. Complete ownership cleanup in the generic and RT-Smart channel timeout callbacks. Add deterministic scheduler and LWP regressions for Event, Semaphore, Mailbox, Message Queue, sender, and receiver paths.
2026-04-07[kernel]Rewrite rt_thread_get_usage to use incremental statistics based on ↵Rbb666
sampling windows.
2026-04-07fix[src][thread]: add defensive check for idle thread suspensionwdfk-prog
2025-12-11fix: [kernel] [thread] Resolve delayed thread wakeup bug when calling ↵Kurngsy
suspend repeatedly (#10970) * Enhance thread suspend function with stricter checks Refactor thread suspension logic to improve clarity and correctness. * Clean up formatting in thread.c Removed unnecessary blank line in thread.c. * Refactor thread suspend state handling Refactor thread suspension logic to improve clarity and maintainability. * Update thread.c * Fix indentation for RT_THREAD_SUSPEND_KILLABLE case
2025-09-30doxygen: cleanup code for group_thread_managementChen Wang
The cleanup involved three parts: - Merging the standalone "/**@{*/" into "@addtogroup group_thread_management" - Changing "/**@}*/" to "/** @} group_thread_management */", adding the group name makes it easier to find the matching "@{" part. - Deleting the "@addtogroup" directive in "include/rtthread.h" because this header file doesn't have doxygen comments. All doxygen comments for function bodies are defined in other .c files. Note, we remian two doxygen comments for rt_thread_inited_hookproto_t and rt_thread_idle_sethook in the "include/rtthread.h". rt_thread_inited_hookproto_t is really defined here. For rt_thread_idle_sethook, please see FIXME comment for reason. Signed-off-by: Chen Wang <[email protected]>
2025-09-12移除已经废弃的CPU使用率相关的字段和初始化代码蒙蒙plus
2025-09-09[add][thread]Add api:rt_thread_suspend_force allow suspend other threads.Rbb666
2025-09-02doxygen: updated doc for thread management subsystemChen Wang
Signed-off-by: Chen Wang <[email protected]>
2025-06-25doxygen: group name all in lowcaseChen Wang
This patch only updated the groups defined in documentation/0.doxygen. Other groups will be moved into documentation/0.doxygen and updated at that time. Signed-off-by: Chen Wang <[email protected]>
2025-04-13add RT_THREAD_CTRL_SET_PRIORITYwycwyhwyq
2025-04-13add RT_THREAD_CTRL_SET_PRIORITYwycwyhwyq
2025-04-13[src] fix mutex bugwycwyhwyq
2025-03-12修复 MMCSD 宏拼写错误+内核开启LOG_D编译问题yixinghua121
2025-02-15doxygen: add prefix for groups (#9991)Chen Wang
* doxygen: add prefix for groups Add "group_" prefix to doxygen group names. This makes it easier to grep with group name later. This patch only modifies the groups defined in the pathes of INPUT of documentation/Doxyfile: INPUT = . \ ../src \ ../include \ ../components/finsh \ ../components/drivers/include/drivers \ ../components/drivers/clk \ ../components/dfs/dfs_v2/src \ ../components/dfs/dfs_v2/include Other groups are not touched. Signed-off-by: Chen Wang <[email protected]> * ci: fixed error report when run file_check.py Such as: - "please delete extra space at the end of this line." - "the RT-Thread error code should return negative value. e.g. return -RT_ERROR" Signed-off-by: Chen Wang <[email protected]> --------- Signed-off-by: Chen Wang <[email protected]>
2024-12-18[kernel] change size_t to rt_size_tguozhanxin
2024-09-11[kernel][mutex] fix bug of thread exit without releasing mutex & add error ↵zms123456
check log
2024-08-27feat: add memset zero for rt_thread_initShell
`rt_object_allocate()` will clear memory after new rt_thread allocate in `rt_thread_create()`. However, in `rt_thread_init()` the same behavior is missing, which corrupt the consistence of the API. Changes: - Added `memset()` zero for `rt_thread_init()` in the entry Signed-off-by: Shell <[email protected]>
2024-06-29[src][thread]fix rt_thread_resume return value error (#9114)zms123456
fix rt_thread_resume return value error
2024-05-28[arm64] add hw thread self (#8942)Shell
* [libcpu] arm64: Add hardware thread_self support This patch introduces hardware-based thread self-identification for the AArch64 architecture. It optimizes thread management by using hardware registers to store and access the current thread's pointer, reducing overhead and improving overall performance. Changes include: - Added `ARCH_USING_HW_THREAD_SELF` configuration option. - Modified `rtdef.h`, `rtsched.h` to conditionally include `critical_switch_flag` based on the new config. - Updated context management in `context_gcc.S`, `cpuport.h` to support hardware-based thread self. - Enhanced `scheduler_mp.c` and `thread.c` to leverage the new hardware thread self feature. These modifications ensure better scheduling and thread handling, particularly in multi-core environments, by minimizing the software overhead associated with thread management. Signed-off-by: Shell <[email protected]> * fixup: address suggestion * fixup: rt_current_thread as global * scheduler: add cpu object for UP scheduler Also, maintain the rt_current_thread in cpu object on UP scheduler. --------- Signed-off-by: Shell <[email protected]>
2024-05-16[libcpu/arm64] add C11 atomic ticket spinlock (#8882)Shell
* [libcpu/arm64] add C11 atomic ticket spinlock Replace the former implementation of flag-based spinlock which is unfair Besides, C11 atomic implementation is more readable (it's C anyway), and maintainable. Cause toolchain can use their builtin optimization and tune for different micro-architectures. For example armv8.5 introduces a better instruction. The compiler can help with that when it knows your target platform in support of it. Signed-off-by: Shell <[email protected]> * fixup: RT_CPUS_NR --------- Signed-off-by: Shell <[email protected]>
2024-05-10[smart] fixup arm64 aspace switch (#8925)Shell
* [smart] fixup arm64 aspace switch Signed-off-by: Shell <[email protected]> * fixup: arm add arch_kernel_mmu_table_get --------- Signed-off-by: Shell <[email protected]>
2024-05-01[kernel] add rt_thread_close()Shell
* [thread] Add rt_thread_close() This patch introduces a new function `rt_thread_close()` to enhances the usability and maintainability by providing a dedicated mechanism for closing threads. - A new function `rt_thread_close()` is added to the API, providing a standardized approach for closing threads. - The `rt_thread_close()` function removes a thread from the thread queue, updates its status to indicate closure, and performs the thread timer detaching which is a embedded timer in thread object. - Additionally, the `rt_thread_detach()` function is modified to utilize `rt_thread_close()` internally, streamlining the thread detachment process. Signed-off-by: Shell <[email protected]>
2024-04-16[fix] 添加创建线程函数时间片参数检查 (#8807)Yaochenger
2024-02-23🎯 Sync smart & scheduler codes (#8537)Shell
Signed-off-by: Shell <[email protected]> Co-authored-by: xqyjlj <[email protected]>
2024-02-19[kernel] fix some strict compiling warningsMeco Man
2024-01-05✨ feat: delete thread ref (#8456)xqyjlj
2024-01-02🐞 fix(thread): fix thread sleep (deadlock)xqyjlj
2024-01-02[kernel] support for hook listShell
Signed-off-by: Shell <[email protected]>
2023-12-27🐞 fix: fix rt_thread_delay, assert, deadlock (#8366)xqyjlj
2023-12-24🐞 fix(thread): fix thread_exit/detach/delete (#8365)xqyjlj
2023-12-24Fix softtimer resume (#8393)geniusgogo
2023-12-07[kernel] release mutex when thread delete (#8345)Yuqiang Wang
2023-12-06release mutex when thread deleteskychen123
2023-10-30实现MPU抽象层 (#8080)tangzz98
- 为RT-Thread设计MPU抽象层,支持ARMV7-M,ARMV8-M架构,让用户使用MPU检测栈溢出等内存问题,实现线程内存隔离 - 在components/mp目录下提供通用的API,libcpu目录下提供各处理器架构的具体实现 - 在STM32U575 NUCLEO, STM32H75 NUCLEO开发板测试通过
2023-10-25🎈 perf: perf rt_hw_interrupt_disable/enable (#8042)xqyjlj
Signed-off-by: Shell <[email protected]> Co-authored-by: Shell <[email protected]>
2023-10-17Sync dfs lwp (#8123)geniusgogo
2023-09-15[src] remove useless codes in kernelShell
Signed-off-by: Shell <[email protected]>
2023-07-20[component/lwp] support more feature of signal from IEEE Std 1003.1-2017 (#7828)Shell
Signed-off-by: Shell <[email protected]>
2023-07-09[debug] remove RT_DEBUG_xxxMeco Man
remove RT_DEBUG_THREAD RT_DEBUG_SCHEDULER RT_DEBUG_IPC RT_DEBUG_TIMER RT_DEBUG_IRQ RT_DEBUG_MEM RT_DEBUG_SLAB RT_DEBUG_MEMHEAP
2023-06-29[include][dbg]update: no longer use RT_DEBUG_LOG in rtdebug.h (#7750)Shicheng Chu
2023-05-17[include][src] Add API to get object name and thread name (#7507)Fan Yang
Signed-off-by: Fan YANG <[email protected]> Co-authored-by: Man, Jianting (Meco) <[email protected]>
2023-05-17[kernel][src] improve code (#7367)半吊子内核开发
2023-04-28[HUST CSE][kernel][thread] 变量 rt_err 没有初始化 (#7401)Pikachu
2023-04-04[kernel] 将rt_thread结构体改为显式继承rt_object (#7131)Shicheng Chu
2023-02-02[doxygen] Fix some warnings in doxygen (#6899)tuduweb
2022-12-16[rt-smart] 弱化 RT_USING_LWP,使用 RT_USING_SMART 作为宏配置 (#6740)guo
* [dfs] sync cromfs * [rt-smart]Weaken RT_USING_LWP, use RT_USING_SMART as macro configuration * [format] fix some format issue.
2022-12-03sync branch rt-smart. (#6641)guo
* Synchronize the code of the rt mart branch to the master branch. * TTY device * Add lwP code from rt-smart * Add vnode in DFS, but DFS will be re-write for rt-smart * There are three libcpu for rt-smart: * arm/cortex-a, arm/aarch64 * riscv64 Co-authored-by: Rbb666 <[email protected]> Co-authored-by: zhkag <[email protected]>
2022-10-15[Kernel] Add nested mutex featureBernard Xiong
2022-08-31[kernel] 当tick为0时rt_thread_sleep不应该挂起线程Ylne
2022-08-31[kernel] 为rt_thread_sleep添加上下文检查Ylne