首先声明,《Linux C程序设计大全》这本书错误一大堆(九成九是学生写的),请大家积极怀疑
#include <stdio.h>
#include <signal.h>

int main()
{
        sigset_t sig_set;
        sigemptyset(&sig_set);
        sigaddset(&sig_set,SIGALRM);

        if( sigismember(&sig_set,SIGALRM)==1 )
             printf("SIGALRM has been set\n");
        else
             printf("SIGALRM not been set\n");
  
        signal(SIGALRM,sigusr1_handler);

         if(sigprocmask(SIG_BLOCK,&sig_set,NULL)==-1)
             printf("fail to set mask\n");
         else
             printf("set mask ok\n");
    
         raise(SIGALRM);
         alarm(5);
    
         while(1)
         {
            printf("on\n");
            sleep(1);
         }

        return 0;
}
这个程序由于对SIGALRM信号进行了屏蔽,所以并没有Alarm Clock出来终止进程,可是,这个信号还是存在的,叫做未决信号,一旦把这个屏蔽去掉,这个信号立马就蹦出来了,不过同类的信号只能有一个未决信号,其它忽略