Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!tcdcs!bofin!cjmchale From: cjmchale@cs.tcd.ie (Ciaran McHale) Newsgroups: comp.windows.x Subject: Re: Interrupting an X program... how? Message-ID: <1991Mar2.172400.23214@cs.tcd.ie> Date: 2 Mar 91 17:24:00 GMT References: <1991Mar1.045842.21676@contact.uucp> Organization: DSG, Dept. of Comp. Sci., Trinity College, Dublin. Lines: 47 In <1991Mar1.045842.21676@contact.uucp> egr@contact.uucp (Gordan Palameta) writes: >A traditional program under Unix can be interrupted by hitting Control-C >(or whatever other character defined by stty). > >How do you send a signal to an X program? > >Specifically, a program which goes off and does lengthy >calculations, and doesn't check for X events until the calculations >are complete. > >Recasting this (existing) program to check for X events during the >aforesaid lengthy computations is not really an option (among other >things, the computations are in Fortran). :-( > >So how can I arrange for the window manager or whatever to send a signal >to a program running in an X window? Several approaches spring to mind. 1. Many window managers will popup a menu if you press a mouse button in the root window. One of the choices on this menu is likely to be labelled something like "Kill window." Choose this (the cursor will probably change it's appearance to show it has been selected) and then press the cursor in the application you want to kill. 2. Split your application up into two processes; a "fron-end" process which handles the X interface, and a "back-end" process will does a lot of CPU intensive work. These two processes can communicate with each other via pipes/sockets/FIFO/whatever-IPC-mechanism-your-OS-supports. All :-) that need be done then is to get the front-end process to listen to both the X server and the back-end process at the same time. If you want to take this approach then email me and I'll send you a collection of emails (about 25k long) which discuss how to do this in detail. Ciaran. -- Ciaran McHale "Verbosity says it all" ____ Department of Computer Science, Trinity College, Dublin 2, Ireland. \ / Telephone: +353-1-772941 ext 1538 FAX: +353-1-772204 \/ Telex: 93782 TCD EI email: cjmchale@cs.tcd.ie