I've been trying out the signal handler on Windows. Executive summary: SIGFPE and SIGSEGV are handled properly. The other signals are essentially useless on Windows machines. However, the Windows task manager will apparently post a WM_CLOSE message to LyX before wacking it with a TerminateProcess. Thus, it would be intelligent to add a handler for this message instead of the useless SIGTERM hander.
Clearly, Lars isn't going to like this, but it seems the intelligent thing to do anyway. Angus ========================================================================== http://aspn.activestate.com/ASPN/Mail/Message/ActiveTcl/2034055 ...signals are mostly useless on Windows for a variety of reasons that are Windows specific. These can be seen in the 'signal' MSDN docs, selectively quoted: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ dnucmg/html/UCMGch09.asp Equivalent URL: http://tinyurl.com/6fdlv "Note SIGINT is not supported for any Win32 application including Windows NT and Windows 95. When a CTRL+C interrupt occurs, Win32 operating systems generate a new thread to specifically handle that interrupt. This can cause a single-thread application such as UNIX, to become multithreaded, resulting in unexpected behavior." ... "The SIGILL, SIGSEGV, and SIGTERM signals are not generated under Windows NT. They are included for ANSI compatibility. Thus you can set signal handlers for these signals with signal, and you can also explicitly generate these signals by calling raise." So SIGINT isn't what you expect to get on Windows, and SIGTERM is only going to come from another process actually sending that signal using 'raise' in Windows' POSIX compatability layer, but not from the general "terminate process" methods that everyone actually uses. ========================================================================== Reading further, the MS Knowledge base has an article entitled 'How To Terminate an Application "Cleanly" in Win32' http://support.microsoft.com/default.aspx?scid=kb;en-us;178893 It essentially comes down to "Post a WM_CLOSE to all Top-Level windows owned by the process that you want to shut down", giving the app a chance to clean up after itself, before wacking it with a TerminateProcess(). Reading further still, this article goes through the process in detail. Kill an App Gently http://www.ftponline.com/archives/premier/mgznarch/vbpj/2001/09sep01/dt0109/dt0109.asp Equivalent URL: http://tinyurl.com/69nvk -- Angus