[Kernel] Fix the critical issue when scheduler not start

This commit is contained in:
Bernard Xiong 2019-04-04 10:58:24 +08:00
parent d517389e52
commit 0366eb13ac
1 changed files with 5 additions and 2 deletions

View File

@ -884,15 +884,18 @@ void rt_exit_critical(void)
level = rt_hw_interrupt_disable(); level = rt_hw_interrupt_disable();
rt_scheduler_lock_nest --; rt_scheduler_lock_nest --;
if (rt_scheduler_lock_nest <= 0) if (rt_scheduler_lock_nest <= 0)
{ {
rt_scheduler_lock_nest = 0; rt_scheduler_lock_nest = 0;
/* enable interrupt */ /* enable interrupt */
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
if (rt_current_thread)
{
/* if scheduler is started, do a schedule */
rt_schedule(); rt_schedule();
} }
}
else else
{ {
/* enable interrupt */ /* enable interrupt */