4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-18 16:03:30 +08:00

[Kernel] Fix the critical issue under smp

This commit is contained in:
Bernard Xiong 2019-04-04 10:06:28 +08:00
parent b490052579
commit d517389e52

View File

@ -792,6 +792,12 @@ void rt_enter_critical(void)
level = rt_hw_local_irq_disable();
current_thread = rt_cpu_self()->current_thread;
if (!current_thread)
{
rt_hw_local_irq_enable(level);
return ;
}
/*
* the maximal number of nest is RT_UINT16_MAX, which is big
* enough and does not check here
@ -842,6 +848,11 @@ void rt_exit_critical(void)
level = rt_hw_local_irq_disable();
current_thread = rt_cpu_self()->current_thread;
if (!current_thread)
{
rt_hw_local_irq_enable(level);
return ;
}
current_thread->scheduler_lock_nest --;