对rt_tick_increase临界区进行保护
This commit is contained in:
parent
84fb09230f
commit
f34e9323b4
13
src/clock.c
13
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();
|
||||
|
|
Loading…
Reference in New Issue