头文件:#include <unistd.h>
#include <signal.h>
int main(void)
{
sigset_t sigset;
//清空信号集
sigemptyset(&sigset);
//将所有信号填充到信号集中
// sigfillset(&sigset);
//往信号集中添加某个信号
sigaddset(&sigset, SIGKILL);
sigaddset(&sigset, SIGALRM);
sigaddset(&sigset, SIGSTOP);
//if (1 == sigismember(&sigset, SIGHUP))
//判断信号集中是否含有某个信号
if (1 == sigismember(&sigset, SIGSTOP))
{
printf("set has this sig\n");
}
else
{
printf("not in\n");
}
//从信号集中删除某个信号
sigdelset(&sigset, SIGSTOP);
if (1 == sigismember(&sigset, SIGSTOP))
{
printf("set has this sig\n");
}
else
{
printf("not in\n");
}
return 0;
}