System signals

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Apr 30 08:42:21 PDT 2012


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.


T

-- 
GEEK = Gatherer of Extremely Enlightening Knowledge


More information about the Digitalmars-d mailing list