10.12 信号_sigprocmask函数

来源:互联网 发布:淘宝外设天下假货 编辑:程序博客网 时间:2024/05/26 07:30
  • #include <signal.h>
  • int sigprocmask(int how, const sigset_t *restrict set,sigset_t *restrict oset);

返回值:成功返回0,出错返回-1

    首先,若oset是非空指针,那么进程的当前信号屏蔽字通过oset返回。其次,若set是一个非空指针,则参数how指示如何修改当前信号屏蔽字。最后,如果set是空指针,则不改变该进程的信号屏蔽字,how的值也无意义。

Figure 10.12 Ways to change current signal mask using sigprocmask

how

Description

SIG_BLOCK

The new signal mask for the process is the union of its current signal mask and the signal set pointed to by set. That is, set contains the additional signals that we want to block.

SIG_UNBLOCK

Thenew signal mask for the process is the intersection of its currentsignal mask and the complement of the signal set pointed to by set. That is, set contains the signals that we want to unblock.

SIG_SETMASK

The new signal mask for the process is replaced by the value of the signal set pointed to by set.

 

    在调用sigprocmask后如果有任何未决的、不再阻塞的信号,则在sigprocmask返回前,至少会将其中一个信号递送给该进程。

原创粉丝点击