多线程编程指南

pthread_sigmask 语法

int	pthread_sigmask(int how, const sigset_t *new, sigset_t *old);
#include <pthread.h>

#include <signal.h>



int ret;

sigset_t old, new;



ret = pthread_sigmask(SIG_SETMASK, &new, &old); /* set new mask */

ret = pthread_sigmask(SIG_BLOCK, &new, &old); /* blocking mask */

ret = pthread_sigmask(SIG_UNBLOCK, &new, &old); /* unblocking */

how 用来确定如何更改信号组。how 可以为以下值之一:

new 的值为 NULL 时,how 的值没有意义,线程的信号掩码不发生变化。要查询当前已阻塞的信号,请将 NULL 值赋给 new 参数。

除非 old 变量为 NULL,否则 old 指向用来存储以前的信号掩码的空间。