From 37960723b8fe6c91d14c7c4c1c30a97d17e0033b Mon Sep 17 00:00:00 2001 From: geniusgogo Date: Fri, 28 May 2021 09:43:06 +0800 Subject: [PATCH] fix rt_tick_increase critical code protection --- src/clock.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/clock.c b/src/clock.c index 0880d8d241..8746d463c1 100644 --- a/src/clock.c +++ b/src/clock.c @@ -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(); }