- 论坛徽章:
- 4
|
回复 1# surpassgood
应当分为两段看,17-19为一段,19-25为一段。
19-25之间发生信号的话,应当是等执行到25行时执行信号处理函数。
17-19之间发生的话:
apue中是这样说的- If a signal that is blocked is generated for a process, and if the action for that signal is either the default action or to catch the signal, then the signal remains pending for the process until the process either (a) unblocks the signal or (b) changes the action to ignore the signal.
复制代码 posix是这样说的- An implementation registers a signal as pending on the process when no thread has the signal unblocked and there are no threads blocked in a sigwait() function for that signal. Thereafter, the implementation delivers the signal to the first thread that unblocks the signal or calls a sigwait() function on a signal set containing this signal rather than choosing the recipient thread at the time the signal is sent.
复制代码- In the 4.3 BSD system, signals that are blocked and set to SIG_IGN are discarded immediately upon generation. For a signal that is ignored as its default action, if the action is SIG_DFL and the signal is blocked, a generated signal remains pending. In the 4.1 BSD system and in System V Release 3 (two other implementations that support a somewhat similar signal mechanism), all ignored blocked signals remain pending if generated. Because it is not normally useful for an application to simultaneously ignore and block the same signal, it was unnecessary for POSIX.1 to specify behavior that would invalidate any of the historical implementations.
复制代码 从上面可以看出只要不是太早的系统的话,apue说的应当就是对的。
对于你的问题中,就是:如果之前对于信号的处理是SIG_IGN,17-19之间产生的信号就会丢弃,否则就是等到25行时调用信号处理程序。
|
|