in_irq() in_softirq() in_interrupt() 函数区别



#define hardirq_count() (preempt_count() & HARDIRQ_MASK)
#define softirq_count() (preempt_count() & SOFTIRQ_MASK)
#define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK \
     | NMI_MASK))

/*
 * Are we doing bottom half or hardware interrupt processing?
 * Are we in a softirq context? Interrupt context?
 */
#define in_irq()   (hardirq_count())      //判断当前是否在硬件中断上下文
#define in_softirq()  (softirq_count())  //判断当前是否在软件中断上下文
#define in_interrupt()  (irq_count())    //判断当前是否在硬件、软件、底半部中断上下文

你可能感兴趣的:(网络)