File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 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,14 @@ 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 ();
287+ struct rt_thread * curr_thread ;
288288
289289 /* disable interrupt */
290290 level = rt_hw_interrupt_disable ();
291291
292+ /* using local variable to avoid unnecessary function call */
293+ curr_thread = rt_thread_self ();
294+
292295 /* check the scheduler is enabled or not */
293296 if (rt_scheduler_lock_nest == 0 )
294297 {
You can’t perform that action at this time.
0 commit comments