[comp.windows.x.motif] SIGINT inside X

dvb@emisle.emisle (David Van Beveren) (01/19/91)

I have an X application that sometimes (unavoidably) takes a long time
between picking up events. These functions aer writing to an XmText widget,
and the text is getting written, so I assume that this function does the
writing to the server, rather than just generating an event (Expose?) and
having the expose callback update the text in the widget.

Sometimes, the user generates a request that takes a LONG time to get back
to the event loop. (This is a DSP program, the user may accidentally 
request an FFT on 100,000 points insteas of 10,000). In this case, the user
can move to the xterm where the process was run from (in the foreground) and
hit ctrl-c. The SIGINT is picked up by the program. 

Currently, the ctrl-c handler does cleanup, and longjumps back to the event
loop. This causes problems with X. Specifically, the text widget goes blank and
does not take any more text written to it. Also, if the program is blocked in
XGetNextEvent, and a ctrl-C is received, more problems, like the program
stops taking events altogether. I can understand that the x-code can't take
being longjumped out of. However, is there any way to 'clean-up' before exiting?

I know this design can be improved, but I didn't design it. It is a port from
VMS and the idea of multitasking via fork() never occured to the original
designers. This will be done eventually, but we need a work-around now. The
best we have come up with is having the ctrl-C handler set a flag and exit.
Then the code has sprinkled through it checks of the flag, and if it is 
detected, then a clean exit is made. 

Summary: If anybody knows how to clean-up after jumping out of X via signal,
         or if anybody knows you cannot do this, let me know please. E-mail
         responses will be summarized and posted.
dvb

David Van Beveren                           INTERNET: emisle!dvb@ism.isc.com
EIS ltd. Professional Software Services     UUCP:   ..uunet!emisle!dvb
voice: (818) 587-1247