Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!dogie.macc.wisc.edu!uwvax!ub.d.umn.edu!cs.umn.edu!sctc.com!pasturel From: pasturel@sctc.com (Pierre Pasturel) Newsgroups: comp.windows.x.motif Subject: Re: delay loop Keywords: XtAddTimeOut Message-ID: <1990Dec14.174652.2961@sctc.com> Date: 14 Dec 90 17:46:52 GMT References: <1990Dec13.170905.21902@sctc.com> <1990Dec13.201435.1457@dirtydog.ima.isc.com> Distribution: comp.windows.x.motif comp.windows.x Organization: Secure Computing Technology Corporation Lines: 38 rowan@ima.isc.com (Rowan Hawthorne) writes: >In article <1990Dec13.170905.21902@sctc.com>, pasturel@sctc.com (Pierre Pasturel) writes: >|> >|> I want to use XtAddTimeOut to cause a delay X in msec in a callback by >|> doing this: >|> >|> timer_id = XtAddTimeOut(X,delay_done,NULL); >|> >|> while ( done == FALSE ) { >|> } >|> >|> where delay_done is the processing procedure which will set the done flag >|> to TRUE when X msecs have expired. The problem is, the while loop >|> sits in a tight loop forever and the Time Out never occurs. >How about calling XtNextEvent and XtProcessEvent in that loop, instead >of having a tight loop? > Rowan I am no X event expert (actually, I just use XtMainLoop to do the processing for me), but I was reading a little about events and it would appear that it might get tricky if I have a XtMainLoop() in main() and another event loop in a callback waiting for a timer event. Does anyone out there know a clean solution to this where I can keep my XtMainLoop in main() but block waiting in a callback waiting for the event that will be caused by XtAddTimeOut and then continue executing at the point where I blocked waiting on the timer event in the callback?? A sample of code would help. Thanks, Pierre pasturel@sctc.com