Skip to content

Commit 84f98ca

Browse files
committed
🎈 perf(signal): optimizec signal
1 parent 30964a8 commit 84f98ca

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

src/scheduler_mp.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ static void _scheduler_stack_check(struct rt_thread *thread)
120120

121121
rt_kprintf("thread:%s stack overflow\n", thread->parent.name);
122122

123-
level = rt_hw_interrupt_disable();
123+
level = rt_hw_local_irq_disable();
124+
rt_spin_lock(&_spinlock);
124125
while (level);
125126
}
126127
#ifdef ARCH_CPU_STACK_GROWS_UPWARD
@@ -571,21 +572,21 @@ void rt_schedule(void)
571572

572573
#ifdef RT_USING_SIGNALS
573574
/* check stat of thread for signal */
574-
level = rt_hw_interrupt_disable();
575+
rt_spin_lock(&(current_thread->spinlock));
575576
if (current_thread->stat & RT_THREAD_STAT_SIGNAL_PENDING)
576577
{
577578
extern void rt_thread_handle_sig(rt_bool_t clean_state);
578579

579580
current_thread->stat &= ~RT_THREAD_STAT_SIGNAL_PENDING;
580581

581-
rt_hw_interrupt_enable(level);
582+
rt_spin_unlock(&(current_thread->spinlock));
582583

583584
/* check signal status */
584585
rt_thread_handle_sig(RT_TRUE);
585586
}
586587
else
587588
{
588-
rt_hw_interrupt_enable(level);
589+
rt_spin_unlock(&(current_thread->spinlock));
589590
}
590591
#endif /* RT_USING_SIGNALS */
591592

src/signal.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,6 @@ static void _signal_entry(void *parameter)
5353
rt_thread_handle_sig(RT_FALSE);
5454

5555
#ifdef RT_USING_SMP
56-
{
57-
struct rt_cpu* pcpu = rt_cpu_self();
58-
59-
RT_ASSERT(pcpu->current_thread->cpus_lock_nest > 0);
60-
pcpu->current_thread->cpus_lock_nest--;
61-
if (pcpu->current_thread->cpus_lock_nest == 0)
62-
{
63-
pcpu->current_thread->scheduler_lock_nest--;
64-
}
65-
66-
}
6756
#else
6857
/* return to thread */
6958
tid->sp = tid->sig_ret;

0 commit comments

Comments
 (0)