Listing 2 shows one way to register a signal handler.
清单2给出了一种注册信号处理程序的方法。
Suppose that the signal handler USES gethostbyname, which is non-reentrant.
假定信号处理器使用了不可重入的gethostbyname。
There can be only one signal handler per signal per process active at any instant.
在任何瞬间,只能有一个信号处理程序处理一个活动进程的一个信号。
The code in Listing 8 implements a signal handler to deal with the incoming SIGCHLD signal.
清单8中的代码实现了一个处理传入的SIGCHLD信号的信号处理程序。
The process then continues executing, but the instructions in the signal handler are now executed.
然后进程继续执行,但现在执行的是信号处理器中的指令。
The signal handler cannot be set.
无法设置信号处理程序。
The call was interrupted by a signal handler.
函数调用被信号处理函数中断。
This example shows what can happen if a signal handler runs in the middle of modifying a variable.
这个例子展示了在修改某个变量的过程中运行信号处理器可能会发生什么事情?
Saving and restoring the value of errno in the signal handler, as follows, can resolve the problem
如下,在信号处理器内保存和恢复errno的值,可以解决这一问题
Now, in the signal handler you can't tell what the process was executing when the signal was caught.
现在,在信号处理器中您并不知道信号被捕获时进程正在执行什么内容。
The first way is to install a signal handler for the SIGBUS signal, and then simply call return in the handler.
第一种方式是为SIGBUS信号设置信号处理程序,并在处理程序中简单的执行return语句。
The only thing you should normally do inside a signal handler is set a global flag that will be processed later.
在一个信号处理器内部,您通常应该做的一件事是,设置一个将在以后处理的全局标记。
Note that condition functions are not asynchronously signal-safe and should not be called from a signal handler.
注意,条件函数并不是异步信号安全的,因此不能在信号处理函数中调用。
But you're better off setting flags — and nothing else — in a signal handler, as opposed to trying to create sophisticated handlers.
但是您最好只在一个信号处理器中设置标记(别的什么都不做),这胜过尝试创建复杂的处理器。
If the signal handler returns, the process continues executing the normal sequence of instructions it was executing when the signal was caught.
如果信号处理器返回,则进程继续执行信号被捕获时正在执行的正常的指令序列。
When the signal handler doesn't disable, the process might show up in the "current" status as signal handling, which might hide the real problem.
未禁用信号处理程序时,进程在“当前”状态中可能表现为正在进行信号处理,从而可能隐藏了真正问题。
Normally, the signal handler will return and cause the ioctl to be entered at exactly the point where it was left so the SPU program can continue.
通常,信号处理程序将会返回,并进入上次离开时ioctl的位置处,这样SPU程序就可以继续执行了。
When a signal that is being caught is handled by a process, the normal sequence of instructions being executed by the process is temporarily interrupted by the signal handler.
当进程处理所捕获的信号时,正在执行的正常指令序列就会被信号处理器临时中断。
When a signal that is being caught is handled by a process, the normal sequence of instructions being executed by the process is temporarily interrupted by the signal handler.
当进程处理所捕获的信号时,正在执行的正常指令序列就会被信号处理器临时中断。
应用推荐