屏蔽信号集
设置屏蔽信号集
#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; }

浙公网安备 33010602011771号