Cstruct Sigaction's sa_mask Field and sigprocmask() 函数



struct sigaction:

struct sigaction {
       void      (*sa_handler)(int);   /* addr of signal handler, */
                                       /* or SIG_IGN, or SIG_DFL */
       sigset_t sa_mask;               /* additional signals to block */
       int      sa_flags;              /* signal options, Figure 10.16 */
       /* alternate handler */
       void     (*sa_sigaction)(int, siginfo_t *, void *);
    };

sigprocmask功能:

   int sigprocmask(int how, const sigset_t *restrict set, sigset_t *restrict oset);

struct sigactionsa_masksigprocmask()函数都能屏蔽信号?有什么区别呢?

struct sigaction中的掩码是在信号处理程序运行时将被阻塞(在信号处理程序执行的线程中)的信号。

用sigprocmask()建立的掩码是将被进程阻塞的信号(并且应该只在单线程程序中使用)

最新更新