Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!rex!rouge!gator.cacs.usl.edu From: pcb@gator.cacs.usl.edu (Peter C. Bahrs) Newsgroups: comp.windows.x Subject: RE: mainloop and signals Message-ID: <5007@rouge.usl.edu> Date: 8 Mar 90 16:12:03 GMT Sender: anon@rouge.usl.edu Distribution: usa Organization: The Center for Advanced Computer Studies, USL Lines: 50 > In article <23695@masscomp.ccur.com> mitch@westford.ccur.com (Mitchel Kuninsky) writes: > :I envision a signal handler like: > : > : SignalHandler > : { > : sigFlag = TRUE; > : } > : > :and an XtMainLoop like: > : > : MyMainLoop() > : { > : XEvent event; > : > : for (;;) > : { > :(1) XtNextEvent( &event ); > : if (event.type != NULL_EVENT) /* or something like this. */ > : XtDispatchEvent( &event ); > : if (sigFlag) > : { > : process signal. > : Inhibit signals. > : sigFlag = FALSE; > :(2) Enable signals. > : } > : } > : } > > This may be kind of nit-picking, but ... You have a nasty race here. > What if a signal arrives between the re-enabling of signals at (2) and > the next call to XtNextEvent at (1). > > I believe this points out the need to have the signal-handling more > tightly integrated with the Intrinsics code. > I would like to do a similar thing...instead of using signals I want to do a select on sockets. Any comments or suggestions as to get this more 'tightly integrated...' with Intrinsics? /*----------- Thanks in advance... --------------------------------------+ | Peter C. Bahrs | | The USL-NASA Project | | Center For Advanced Computer Studies INET: pcb@gator.cacs.usl.edu | | 2 Rex Street | | University of Southwestern Louisiana ...!uunet!dalsqnt!gator!pcb | | Lafayette, LA 70504 | +-----------------------------------------------------------------------*/