Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!texbell!texsun!newstop!sun!kimba!hvr From: hvr@kimba.Sun.COM (Heather Rose) Newsgroups: comp.windows.x Subject: Re: X & signals Keywords: xwindows signals Message-ID: <132610@sun.Eng.Sun.COM> Date: 7 Mar 90 03:40:44 GMT References: <1154@sdrc.UUCP> Sender: news@sun.Eng.Sun.COM Reply-To: hvr@sun.UUCP (Heather Rose) Organization: Sun Microsystems, Mountain View Lines: 34 In article <1154@sdrc.UUCP> evgabb@sdrc.UUCP (Rob Gabbard) writes: >Has anyone had any problems with using alarm signals with X ? My problem is >this - I have an X application that may be away from the event loop for >quite some time. So, to avoid overflowing the event queue, I have a routine >that looks somthing like this: > > clean_queue() > { > while ( XPending( display ) ) > { > XtNextEvent( &event ); > XtDispatchEvent( &event ); > } > > signal(SIGALRM,clean_queue); > } > > Upon exiting my event loop to go and do something else I call >signal(SIGALRM,clean_queue) and then use setitimer to send an alarm every >few seconds. Then, when reentering my event loop I turn the timer back off. > > This works fine for a while but it eventually crashes. The error >messages range from invalid protocol requests to bad op codes in >XDeleteProperty. This is running under Ultrix on a DECStation 3100. The XView toolkit provides an interface for signals (including alarms). If you are not using XView, you might want to take a peek at the implementation of the notifier library. XView source is included in the X11R4 distribution. The applicable code would be in /toolkits/XView/lib/libxvin/notify Regards, Heather