Skip to content

Commit 5c7c5ca

Browse files
committed
[kernel]fix scheduling exception caused by interrupt preemption in rt_schedule
1 parent 42458e0 commit 5c7c5ca

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/scheduler_up.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
* 2023-10-17 ChuShicheng Modify the timing of clearing RT_THREAD_STAT_YIELD flag bits
3333
* 2025-08-04 Pillar Add rt_scheduler_critical_switch_flag
3434
* 2025-08-20 RyanCW rt_scheduler_lock_nest use atomic operations
35+
* 2025-09-20 wdfk_prog fix scheduling exception caused by interrupt preemption in rt_schedule
3536
*/
3637

3738
#define __RT_IPC_SOURCE__
@@ -283,12 +284,13 @@ void rt_schedule(void)
283284
rt_base_t level;
284285
struct rt_thread *to_thread;
285286
struct rt_thread *from_thread;
286-
/* using local variable to avoid unecessary function call */
287-
struct rt_thread *curr_thread = rt_thread_self();
288287

289288
/* disable interrupt */
290289
level = rt_hw_interrupt_disable();
291290

291+
/* using local variable to avoid unecessary function call */
292+
struct rt_thread *curr_thread = rt_thread_self();
293+
292294
/* check the scheduler is enabled or not */
293295
if (rt_scheduler_lock_nest == 0)
294296
{

0 commit comments

Comments
 (0)