From f34e9323b430813a6dbb62a609cfb3980aa645b0 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Tue, 1 Jun 2021 11:42:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9rt=5Ftick=5Fincrease=E4=B8=B4=E7=95=8C?= =?UTF-8?q?=E5=8C=BA=E8=BF=9B=E8=A1=8C=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/clock.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/clock.c b/src/clock.c index 8746d463c1..045555933d 100644 --- a/src/clock.c +++ b/src/clock.c @@ -62,6 +62,9 @@ void rt_tick_set(rt_tick_t tick) void rt_tick_increase(void) { struct rt_thread *thread; + rt_base_t level; + + level = rt_hw_interrupt_disable(); /* increase the global tick */ #ifdef RT_USING_SMP @@ -76,17 +79,17 @@ 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_hw_interrupt_enable(level); rt_schedule(); } + else + { + rt_hw_interrupt_enable(level); + } /* check timer */ rt_timer_check();