mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-03-24 09:30:19 +08:00
[Kernel] Fix the signal issue when the context switch is triggered but not immediately handled.
This commit is contained in:
@@ -379,7 +379,12 @@ void rt_schedule(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
#ifdef RT_USING_SIGNALS
|
||||
/* check stat of thread for signal */
|
||||
level = rt_hw_interrupt_disable();
|
||||
if (current_thread->stat & RT_THREAD_STAT_SIGNAL_PENDING)
|
||||
{
|
||||
extern void rt_thread_handle_sig(rt_bool_t clean_state);
|
||||
@@ -395,9 +400,6 @@ void rt_schedule(void)
|
||||
{
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
#else
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
#endif
|
||||
|
||||
__exit:
|
||||
@@ -477,7 +479,13 @@ void rt_schedule(void)
|
||||
|
||||
rt_hw_context_switch((rt_ubase_t)&from_thread->sp,
|
||||
(rt_ubase_t)&to_thread->sp);
|
||||
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
|
||||
#ifdef RT_USING_SIGNALS
|
||||
/* check stat of thread for signal */
|
||||
level = rt_hw_interrupt_disable();
|
||||
if (rt_current_thread->stat & RT_THREAD_STAT_SIGNAL_PENDING)
|
||||
{
|
||||
extern void rt_thread_handle_sig(rt_bool_t clean_state);
|
||||
@@ -493,9 +501,6 @@ void rt_schedule(void)
|
||||
{
|
||||
rt_hw_interrupt_enable(level);
|
||||
}
|
||||
#else
|
||||
/* enable interrupt */
|
||||
rt_hw_interrupt_enable(level);
|
||||
#endif
|
||||
goto __exit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user