Skip to content

Commit 84fb092

Browse files
authored
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
2 parents 472be15 + 3796072 commit 84fb092

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/clock.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,14 @@ void rt_tick_increase(void)
7676
-- thread->remaining_tick;
7777
if (thread->remaining_tick == 0)
7878
{
79+
rt_base_t level;
80+
7981
/* change to initialized tick */
8082
thread->remaining_tick = thread->init_tick;
8183

84+
level = rt_hw_interrupt_disable();
8285
thread->stat |= RT_THREAD_STAT_YIELD;
86+
rt_hw_interrupt_enable(level);
8387

8488
rt_schedule();
8589
}

0 commit comments

Comments
 (0)