如果您过去曾经编写过事件驱动的程序,那么我认为您会发现,对于设置显式事件处理循环这一常见做法,使用信号是一个令人耳目一新的变化。
If you've ever done any event-driven programming in the past, I think you'll find signals to be a refreshing change from the common practice of setting up an explicit event processing loop.
这可以通过在信号处理程序代码中设置一个全局标志并在完成关键部分的代码之后检查这个标志来实现。
This can be achieved by setting a global flag in the handler code and checking for the flag after completion of the critical part.
设置 override_signal_handling 可以确保该程序终止并进行核心转储,即使应用程序已经对这些信号进行了处理。
Setting override_signal_handling ensures that the program terminates and core, even if these signals have been handled by the application.
应用推荐