内核里面屏蔽信号的方法

    spin_lock_irqsave(&current->sigmask_lock, flags);
    oldset = current->blocked;
    sigfillset(&current->blocked);
    recalc_sigpending(current);   //  重新计算current->sigpending
    spin_unlock_irqrestore(&current->sigmask_lock, flags);

/*
    屏蔽信号的部分
*/

    spin_lock_irqsave(&current->sigmask_lock, flags);
    current->blocked = oldset;
    recalc_sigpending(current);
    spin_unlock_irqrestore(&current->sigmask_lock, flags);

你可能感兴趣的:(内核里面屏蔽信号的方法)