j*******e 发帖数: 674 | 1 I install a signal handler for a process.
The handler will catch all the signals except 9 and 23, and do nothing but
"print", and so on.
I found out that that: When the process receive the same signal for a second
time, the handler will not function anymore. And default action for that
signal will take effect.
I can't find any book mention such problem.
Is this a bug in my program, or it is the way that signal works? | m*****e 发帖数: 4193 | 2
This is how signal works on some Unix platform. You need to catch the signal
again in your signal handler.
【在 j*******e 的大作中提到】 : I install a signal handler for a process. : The handler will catch all the signals except 9 and 23, and do nothing but : "print", and so on. : I found out that that: When the process receive the same signal for a second : time, the handler will not function anymore. And default action for that : signal will take effect. : I can't find any book mention such problem. : Is this a bug in my program, or it is the way that signal works?
| o***z 发帖数: 133 | 3 If you set SA_RESETHAND and the signal is caught,
the disposition of the signal is automatically reset to SIG_DFL
【在 j*******e 的大作中提到】 : I install a signal handler for a process. : The handler will catch all the signals except 9 and 23, and do nothing but : "print", and so on. : I found out that that: When the process receive the same signal for a second : time, the handler will not function anymore. And default action for that : signal will take effect. : I can't find any book mention such problem. : Is this a bug in my program, or it is the way that signal works?
| p******f 发帖数: 162 | 4
If you are using signal(2), change to sigaction(2).
【在 j*******e 的大作中提到】 : I install a signal handler for a process. : The handler will catch all the signals except 9 and 23, and do nothing but : "print", and so on. : I found out that that: When the process receive the same signal for a second : time, the handler will not function anymore. And default action for that : signal will take effect. : I can't find any book mention such problem. : Is this a bug in my program, or it is the way that signal works?
|
|