Chinaunix首页 | 论坛 | 博客
  • 博客访问: 323568
  • 博文数量: 106
  • 博客积分: 3081
  • 博客等级: 中校
  • 技术积分: 1090
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-15 14:07
文章分类

全部博文(106)

文章存档

2009年(1)

2007年(34)

2006年(71)

我的朋友

分类: C/C++

2006-05-25 22:07:19

#include
#include
#include
#include




void err_quit(char *);


int main(void)
{
    sigset_t newset;
    if((sigemptyset(&newset))<0)
    err_quit("sigemptyset");
    


    if((sigaddset(&newset,SIGTERM))<0)
    err_quit("sigaddset:SIGTERM");
   
    if((sigaddset(&newset,SIGALRM))<0)
    err_quit("sigaddset:SIGALRM");
       
    if((sigprocmask(SIG_BLOCK,&newset,NULL))<0)
    err_quit("sigprocmask");
   
    pause();  捕捉一个信号才返回.
   
    exit(EXIT_SUCCESS);

   
}




void err_quit(char *msg)
{
    perror(msg);
    exit(EXIT_FAILURE);
}
阅读(989) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~