代码看的不是很懂,
$ ./a.out
program. start:( 游戏 )
in critical regi..on: SIGINT 杀毒
^? . . type the interrupt character 建材
in sig_int: SIGINT SIGUSR1//为什么这里是捕.获的是.SIGUSR1???谁能大致讲一下这个代码[成人用品]
after return from si.gsuspen.d: SIGINT域名
prog.ram exit:.
#inclu.de "apue.h".
static void .sig_int(int);虚拟主机
int
main(void)
{
&.nbsp; sigset_t newmask, oldmask, waitma.sk;
pr_mask("program start..: ");教育
&nbs.p; if (signal(SIGINT, sig_int) == SIG_.ERR)[成人用品]
&nbs.p;&nbs.p; err_sys("sign.al(SIGINT) error");电影
s.igem.ptyset(&waitmask);.
sigaddset.(&waitmask, SIGUS.R1); 电子
&.nbsp;sigemptyset(&newma.sk); 杀毒
.sigaddset(&n.ewmask, SIGINT);<性病>
&nb.sp; &n.bsp;/* 汽车
&n.bsp; &nb.sp;* Block SIGINT and save current signal mask.电脑
&nbs.p;&n.bsp; */--------------彩票
if (sigprocmask(SIG_BLOCK, &newmask,.. &oldmask) < 0).
&nb.sp;  .;err_sys("SIG_BLOCK error");健康
. .;/* 汽车
. * Cr.itical region of code.--- 印刷
&.nbsp; &.nbsp;*/ 外汇
&.nbsp; . pr_mask("in critical region: ");--- 印刷
&n.bsp; &nb.sp;/* 美容
* Pause, allowing all signals except. SIGUS.R1.电影
.. */ 汽车
&nbs.p; if (sigsuspend(.&waitmask) != -1).
. &nb.sp;err_sys(."sigsuspend error");.
pr_mask("after return from s.igsuspend: ".);.
. ./*<性病>
 .; * Reset signal mask which un.blocks SIGINT.( 游戏 )
&.nb.sp;*/[成人用品]
if (sigprocmask(SIG_SETMASK, &oldmask,. NULL) < .0)外贸
&n.bsp;  .; err_sys("SIG_SETMA.SK error");.
&nb.sp; &n.bsp; /*.
&.nbsp; * And conti.nue processing ...<性病>
&nbs..p; */.
&n.bsp; pr_mask.("program exit: "); 乙肝
. exit(.0); 外汇
}
static void
sig_int(int .signo) 汽车
{
pr_mask("\nin sig_int.: ");.[成人用品]
}
[ 本帖最后由 jieao.111 于 2009-.4-20 15:36 编辑 ]学习