[kernel][scheduler]Modify the timing of clearing RT_THREAD_STAT_YIELD… (#8142)

This commit is contained in:
Shicheng Chu 2023-10-30 23:11:40 +08:00 committed by GitHub
parent acc66c5479
commit e78cfdf64b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,6 +29,7 @@
* new task directly
* 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to scheduler.c
* 2023-03-27 rose_man Split into scheduler upc and scheduler_mp.c
* 2023-10-17 ChuShicheng Modify the timing of clearing RT_THREAD_STAT_YIELD flag bits
*/
#include <rtthread.h>
@ -270,7 +271,6 @@ void rt_schedule(void)
{
need_insert_from_thread = 1;
}
rt_current_thread->stat &= ~RT_THREAD_STAT_YIELD_MASK;
}
if (to_thread != rt_current_thread)
@ -287,6 +287,11 @@ void rt_schedule(void)
rt_schedule_insert_thread(from_thread);
}
if ((from_thread->stat & RT_THREAD_STAT_YIELD_MASK) != 0)
{
from_thread->stat &= ~RT_THREAD_STAT_YIELD_MASK;
}
rt_schedule_remove_thread(to_thread);
to_thread->stat = RT_THREAD_RUNNING | (to_thread->stat & ~RT_THREAD_STAT_MASK);