diff options
| author | Bernard Xiong <[email protected]> | 2019-11-12 21:23:56 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2019-11-12 21:23:56 +0800 |
| commit | 6fca4a77224a59c8f0fa50e5399600b9c5080706 (patch) | |
| tree | a2228cc1fb2ac71b11c8fb07f2df42a0b4c1f3d5 /src | |
| parent | e8a864c7c871d3c5b166fd671805bec0a386fe03 (diff) | |
[Kernel] Fix the signal issue when the context switch is triggered but not immediately handled.
Diffstat (limited to 'src')
| -rw-r--r-- | src/scheduler.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/scheduler.c b/src/scheduler.c index f671a49623..8f62384d2a 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -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; } |
