emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Functions in kill-emacs-hook aren't run if emacs gets killed with SI


From: Eli Zaretskii
Subject: Re: Functions in kill-emacs-hook aren't run if emacs gets killed with SIGTERM
Date: Fri, 23 Jan 2009 17:25:31 +0200

> From: "Stefan Monnier" <address@hidden>
> Cc: <address@hidden>,
>       <address@hidden>
> Date: Thu, 22 Jan 2009 16:16:37 -0500
> 
> > I'm more worried by the possibility that they run Lisp code when Emacs
> > is in unstable state.
> 
> The only sane way to implement it is via an event, just like SIGUSRn, so
> I don't see why there would be such a risk.  The risk would rather be
> the opposite: that by delaying execution to a safe time, we may delay it
> indefinitely.

We may also delay it indefinitely if we run Lisp, because that could
infloop, especially if our internal data structures are unstable.

> I'm sure I understand what you mean by "enough", because I'm not sure
> what you think is necessary.  To me what is necessary is:
> 1 - don't lose data.
> 2 - exit reasonably promptly.
> So doing the autosaves before running the hook should make sure
> 1 is preserved.  But running the hook may indeed make us lose 2.
> Is that what you meant by "not enough"?
> 
> To keep number 2, we could schedule a SIGALRM so as to forcefully exit
> after a timeout, in case running the hook doesn't happen quickly enough.

On balance, I would leave things as they are, i.e. don't run
kill-emacs-hook when we get SIGTERM.  After all, we are being killed,
so only the minimum necessary cleanup should be in order.

If SIGTERM is used to programmatically shut down Emacs, I think it's
rather a conceptual bug in whatever uses SIGTERM for that purpose.
Why can't they use SIGUSRn?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]