Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!think.com!linus!philabs!nbc1!nbc1!colin From: colin@nbc1.ge.com (Colin Rafferty) Newsgroups: comp.windows.x Subject: Re: `Sharing' with XtAppMainLoop Message-ID: Date: 4 Mar 91 19:17:22 GMT References: <1991Feb28.162008@csd.uwo.ca> Sender: colin@nbc1.ge.com (Colin Rafferty) Organization: National Broadcasting Company, New York City Lines: 24 In-Reply-To: bradd@csd.uwo.ca's message of 28 Feb 91 21:20:08 GMT In article <1991Feb28.162008@csd.uwo.ca> bradd@csd.uwo.ca (krusty the klown) writes: > I would like to have my program keep cranking away while XtAppMainLoop > is in action. I came up with the following solution, but I'm sure > that there are better ones: > Before starting XtAppMainLoop, call XtAppAddTimeOut with an interval of > 1 millisecond. > Call XtAppMainLoop. > Every time the procedure from XtAppAddTimeOut is called, restart the > timeout with another call to XtAppAddTimeOut. There is an easier and "better" way of doing this. Simply use the XtAppAddWorkProc() call that's defined in the Xt Toolkit Intrinsics book on page 91. This will have XtMainLoop call the procedure itself and you don't have to worry about timeouts and stuff. Just make sure that the procedure doesn't do too much (which you should already be doing). If you don't, your user will get very upset. -- Colin Owen Rafferty | I believe in compulsory cannibalism. colin@nbc1.ge.com | If people were forced to eat (I don't speak for NBC. | what they killed, there would Watch Tom Brokaw for that.) | be no more wars. -- Abbie Hoffman