[Lazarus] Finding out how a program's being terminated

Sven Barth pascaldragon at googlemail.com
Sat Feb 16 11:29:22 CET 2013


>> The thing that initially got me jittery was a shutdown script (from an
>> elderly Slackware) that first signalled term to everything, waited five
>> seconds and signalled kill. But if the term resulted in a dialogue
>> asking whether the state is to be saved then presumably the kill would
>> never OK this.
>>
> That is afaik still the default behaviour of init. You have 5 secs
> between SIGTERM and SIGKILL. Are all users going to click OK in 5 secs?
> Also watch out that a signal handler runs asynchronously. You aren't
> allowed to do a lot in a signal handler and should not use non-reentrant
> functions such as malloc. Pop ups in signal handlers are not a good idea.
>

Additionally the X11 server might already be shutdown itself. E.g. on my 
ArchLinux system the X11 server is shutdown as one of the first (which 
takes all GUI applications with it without asking) and only then all 
remaining processes are terminated using SIGTERM and afterwards SIGKILL.

Regards,
Sven





More information about the Lazarus mailing list