Skip to content

Commit 3796072

Browse files
committed
fix rt_tick_increase critical code protection
1 parent 59bec27 commit 3796072

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)