System signals

Sean Kelly sean at invisibleduck.org
Mon Apr 30 10:14:16 PDT 2012


On Apr 30, 2012, at 8:42 AM, "H. S. Teoh" <hsteoh at quickfur.ath.cx> wrote:

> On Mon, Apr 30, 2012 at 06:50:50AM -0700, Sean Kelly wrote:
>> On Apr 29, 2012, at 9:28 PM, H. S. Teoh wrote:
>> 
>>> On Sun, Apr 29, 2012 at 11:47:24PM +0200, deadalnix wrote:
>>> [...]
>>>> You misunderstood me (the sentence was not clear). I mean, you
>>>> cannot catch kill and the trick mentioned int he link is linux
>>>> specific.  Obviously, the fact that you cannot catch kill isn't
>>>> linux specific ;)
>>> 
>>> Ah, I see.
>>> 
>>> But really? I thought the self-pipe trick is portable across Posix
>>> platforms. But then again, my last contact with a non-Linux Posix
>>> system was, oh, at least 8 years ago with a Solaris workstation, so
>>> I could be totally wrong.
>> 
>> It's legal to call write() in a signal handler, so if the socket is
>> calling select() or poll() or whatever, something along those lines
>> should work just fine.  As for catching kill, I thought the signal
>> handler would fire but when it exited the app would still terminate.
>> No?
> 
> IIRC, catching SIGTERM allows you to not terminate (that's how SIG_IGN
> is implemented, I think). But SIGKILL isn't even catchable to begin
> with, you'll just terminate no matter what.
> 
> But again, my impression may be biased by exclusive use of Linux for the
> last 8 years or so.

You're probably right. So SIGKILL is defined so you can send the signal only. I've never tried to trap it. 


More information about the Digitalmars-d mailing list