屏蔽信号集

设置屏蔽信号集

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>

int main()
{
    // 定义
    sigset_t nset, oset;
    // 初始化
    sigemptyset(&nset);
    // 设置, 屏蔽2号信号
    sigaddset(&nset, SIGINT);
    // 替换
    sigprocmask(SIG_SETMASK, &nset, &oset);


    while (1);

    return 0;
}

 

posted @ 2020-08-24 20:52  x_Aaron  阅读(101)  评论(0)    收藏  举报