mirror of
https://github.com/apache/nuttx.git
synced 2026-08-14 00:43:13 +00:00
sched: we use spin_lock_irqsave replace enter_critical_section to protect g_irqvector
enter_critical_section may be called before os initialized Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
5cee996588
commit
2ee8aa6f2b
2 changed files with 4 additions and 4 deletions
|
|
@ -72,7 +72,7 @@ int irq_attach(int irq, xcpt_t isr, FAR void *arg)
|
|||
* to the unexpected interrupt handler.
|
||||
*/
|
||||
|
||||
flags = enter_critical_section();
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
if (isr == NULL)
|
||||
{
|
||||
/* Disable the interrupt if we can before detaching it. We might
|
||||
|
|
@ -121,7 +121,7 @@ int irq_attach(int irq, xcpt_t isr, FAR void *arg)
|
|||
g_irqvector[ndx].count = 0;
|
||||
#endif
|
||||
|
||||
leave_critical_section(flags);
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ int irqchain_detach(int irq, xcpt_t isr, FAR void *arg)
|
|||
ndx = irq;
|
||||
#endif
|
||||
|
||||
flags = enter_critical_section();
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
|
||||
if (g_irqvector[ndx].handler == irqchain_dispatch)
|
||||
{
|
||||
|
|
@ -264,7 +264,7 @@ int irqchain_detach(int irq, xcpt_t isr, FAR void *arg)
|
|||
ret = irq_detach(irq);
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue