SIGPROCMASK(2) Linux Programmer's Manual SIGPROCMASK(2)
函数 int sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
how:
The behavior of the call is dependent on the value of how, as follows.
SIG_BLOCK
The set of blocked signals is the union of the current set and
the set argument.
SIG_UNBLOCK
The signals in set are removed from the current set of blocked
signals. It is permissible to attempt to unblock a signal which
is not blocked.
1)在shell下,启动一个前台进程。
2)用户按下crtl+c,这个键盘输入产生一个硬件中断
3)如果此时cpu正在运行进程的用户空间代码,
需要切换到内核空间,处理硬件中断。
4)中断驱动程序将crtl+c 解释成一个sigint信号,记
在该进程的PCB中。
5)从内核返回到用户空间的时候,先检查
进程的PCB中是否有信号到达。如果有信号到达,
调用信号处理函数。
6)处理完毕后,继续返回内核,再次判断是否有信号到达。
如有切换到第五步,没有,返回进程的用户态,继续执行。
联系客服