Pthreads中的信号处理

时间:2010-10-21 17:51:12

标签: c pthreads signals

man的{​​{1}}页提及:

pthreads

“信号处置”是什么意思?

3 个答案:

答案 0 :(得分:5)

I信号处理是一个过程在传递信号时所采取的行动。每个信号都有一个配置。有默认值。

来自signal(7)

Signal Dispositions
    Each signal has a current disposition, which determines how the process
    behaves when it is delivered the signal.

[Dispositions are:]
    Term   Default action is to terminate the process.

    Ign    Default action is to ignore the signal.

    Core   Default action is to terminate the process and dump core (see core(5)).

    Stop   Default action is to stop the process.

    Cont   Default action is to continue the process if it is currently stopped.
[...]
    The signal disposition is a per-process attribute: in a multithreaded
    application, the disposition of a particular signal is the same for all
    threads.

答案 1 :(得分:3)

信号的处理方式是如何处理的。

  • 可能会被忽略
  • 可以使用默认响应(取决于信号)来处理
    • 停止
    • 出口
    • 退出核心转储
    • 忽略
  • 可能由用户定义的信号处理程序处理

在调用信号处理程序时,也可能会出现屏蔽信号的问题,等等。

答案 2 :(得分:1)

这意味着Unix进程如何对信号作出反应。请参阅signal(7)