Merge pull request #4741 from geniusgogo/fix_tick_increase

🐛 🐛  **It is strongly recommended to upgrade with all versions of the relevant code.**

fix rt_tick_increase critical code protection
This commit is contained in:
Bernard Xiong 2021-06-01 11:10:26 +08:00 committed by GitHub
commit 84fb09230f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -76,10 +76,14 @@ void rt_tick_increase(void)
-- thread->remaining_tick;
if (thread->remaining_tick == 0)
{
rt_base_t level;
/* change to initialized tick */
thread->remaining_tick = thread->init_tick;
level = rt_hw_interrupt_disable();
thread->stat |= RT_THREAD_STAT_YIELD;
rt_hw_interrupt_enable(level);
rt_schedule();
}