并编写捕获标志信号程序,自定义消息。
The program for capturing sign signal was programmed and specific message was defined.
不过,如果您知道当信号可能到达时,程序不可能使用处理器那个时刻所使用的流,那么就是安全的。
However, if you know that the program cannot possibly use the stream that the handler USES at a time when signals can arrive, you are safe.
信号就是软件中断,可以向正在执行的程序(进程)发送有关异步事件发生的信息。
Signals are software interrupts that send information about an occurrence of an asynchronous event to an executing program, or process.
下面这个示例程序使用了 SIGTERM信号。
信号处理器的消息和程序的数据都会被破坏,因为两个调用操作了同一数据结构:流本身。
Both the signal handler's message and the program's data could be corrupted, because both calls operate on the same data structure: the stream itself.
正如我们期望的一样,这个程序会接收到一个SIGILL(信号编号为4)信号,其si代码为5,这是在用户空间的程序执行特权操作时产生的。
As expected, the program has received a SIGILL (signal number 4) with an si code of 5, which is set when a privileged opcode is executed by a user-space program.
除了必要的模块包含及变量声明之外,信号中断捕捉程序被定义为允许输出每个数据运行的相关的头文件。
In addition to the necessary module includes and variable declarations, the signal-interrupt catcher is defined to allow the associated header for each data run to be printed out.
这个生成的信号可能会改变errno的值,程序的行为会无法预计。
The generated signal can change the value of errno, and the program behaves unexpectedly.
procsig输出进程的信号操作和处理程序。
然后使用值18 (SIGCHLD)来调用信号处理程序,确认子进程的退出,并且父进程返回到sleep (60)。
The signal handler is called with a value of 18 (SIGCHLD), the child's exit is acknowledged, and the parent goes back to its sleep (60).
另一个名为Streamit的项目对数码信号处理中的平行程序进行了开发。
Another project, called StreamIt, exploits the parallelism inherent in much digital signal processing.
对于SIGCHLD信号,应用程序必须调用wait (3c)函数,以等待子进程退出。
For the SIGCHLD signal, the application must call the wait (3c) function to wait for the child process to exit.
假定信号处理器使用fprintf打印一条消息,而当信号发出时程序正在使用同一个流进行fprintf调用。
Suppose the signal handler prints a message with fprintf and the program was in the middle of an fprintf call using the same stream when the signal was delivered.
在任何瞬间,只能有一个信号处理程序处理一个活动进程的一个信号。
There can be only one signal handler per signal per process active at any instant.
这可以通过在信号处理程序代码中设置一个全局标志并在完成关键部分的代码之后检查这个标志来实现。
This can be achieved by setting a global flag in the handler code and checking for the flag after completion of the critical part.
在信号处理应用程序中,如果恢复信号需要乘上一个“满”的矩阵,那么带状矩阵提供的所有的速度优势都将不复存在。
In a signal-processing application, all the speed advantages offered by banded matrices would be lost if restoring the signal required multiplying it by a full matrix.
您务必要知道自己的应用程序是否有信号处理以及如何禁用它们以生成核心文件。
It is important that you know if your application has signal handling, and how to disable them to generate a core file.
清单8中的代码实现了一个处理传入的SIGCHLD信号的信号处理程序。
The code in Listing 8 implements a signal handler to deal with the incoming SIGCHLD signal.
信号处理程序可以编写为忽略这个信号。
未禁用信号处理程序时,进程在“当前”状态中可能表现为正在进行信号处理,从而可能隐藏了真正问题。
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.
真实的应用程序会使用信号量或其他技术控制对共享内存段的读写。
A real application would use semaphores or other techniques to control reading and writing to the Shared segment.
在这个想象期间,大脑之门把那一百个神经细胞的电活动传送给一个处理信号的程序,这个软件将探测信号的规律。
During this imaginative period the BrainGate fed the electrical activity of its century of nerve cells to a piece of signal-processing software that looked for patterns.
这将导致第三个问题:为信号处理程序接收信号的程序调用已包装的调用。
This led to a third problem: Programs that take signals for which the signal handlers invoke wrapped calls.
然后主循环查询自己的信号和处理程序之间的内部映射表,也叫做回调,并调用注册到指定对象的指定信号的处理程序。
The main loop then looks through its internal mapping table between its signals and handlers, also called callbacks, and calls the handlers registered for the given signal on the given object.
一旦驱动程序接收到坐标,它就将有关触摸和任何可用数据的信号发送给用户应用程序,并将数据发送给应用程序(如果可能的话)。
Once the driver receives the coordinates, it signals the user applications about the touch and the availability of any data, and sends the applications the data (if that is possible).
程序中的信号处理程序捕获到函数的执行被某个信号中断,信号处理程序然后按正常方式返回。
EINTR — the function was interrupted by a signal, which was caught by a signal handler in the program, and the signal handler returned normally.
用户进程不允许为所有信号安装处理程序;例如,不允许为SIGKILL和SIGSTOP 安装处理程序。
The user process is not allowed to install handlers for all signals; for instance, installing handlers for SIGKILL and SIGSTOP are not permitted.
信号处理程序中提供了有关在信号发生时要执行的操作的信息。
Signal handlers provide information on the action to be taken when the signal occurs.
信号处理程序中提供了有关在信号发生时要执行的操作的信息。
Signal handlers provide information on the action to be taken when the signal occurs.
应用推荐