[英]Why I had executed sigemptyset before sigaction, but sometimes the SIGALRM is blocked
I had executed 'sigemptyset' before 'sigaction', but the SIGALRM is blocked. 我在“ sigaction”之前执行了“ sigemptyset”,但是SIGALRM被阻止。
But if I execute 'sigprocmask' to unblock SIGALRM, the SIGALRM is not blocked. 但是,如果我执行“ sigprocmask”来解除阻止SIGALRM,则不会阻止SIGALRM。
the part of codes as follow: 代码部分如下:
struct sigaction sa;
memset( & sa, 0, sizeof(sa));
sa.sa_handler = sigpipe_handler;
if (sigemptyset( & sa.sa_mask) < 0) {
printf("sigemptyset fail! errno=%d, error info<%s>.\n", errno, strerror(errno));
}#
ifdef SA_INTERRUPT sa.sa_flags |= SA_INTERRUPT;#
endif
if (sigaction(signum, & sa, NULL) < 0) {
printf("sigaction fail! errno=%d, error info<%s>.\n", errno, strerror(errno));
}–
似乎SIGALRM默认被屏蔽了?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.