Re: TclX on Windows - anybody successfully trap SIGTERM / SIGKILL
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: TclX on Windows - anybody successfully trap SIGTERM / SIGKILL

From: Ralf Fassel <ralfixx@gmx.de>
Date: Thu Dec 22 2005 - 15:11:36 CET

* "suchenwi" <richard.suchenwirth-bauersachs@siemens.com>
| Trapping [exit] is easily done by overloading, e.g.:

But I don't think that will solve the OPs problem, when a process is
terminated by some other process (eg the taskmanager):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/terminating_a_process.asp
    If a process is terminated by TerminateProcess, all threads of the
    process are terminated immediately with no chance to run
    additional code. This means that the thread does not execute code
    in termination handler blocks. In addition, no attached DLLs are
    notified that the process is detaching.

I would *guess* that this function is called by the taskmanager when
terminating a process. This would be the equivalent of kill -KILL [pid]
on Unix.

However, Ctrl-C on the windows *commandline* might be handled by
setting a console control handler:
  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/console_control_handlers.asp
  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/setconsolectrlhandler.asp

HTH
R'
Received on Fri Dec 23 19:03:00 2005