Path: utzoo!utgpu!news-server.csri.toronto.edu!orasis.vis.toronto.edu!tjhorton Newsgroups: comp.windows.x.motif From: tjhorton@vis.toronto.edu ("Timothy J. Horton") Subject: Re: Timer Interrupt Message-ID: <91Jan27.013455est.8650@orasis.vis.toronto.edu> Organization: Department of Computer Science, University of Toronto References: <9101241425.AA23877@alex.CSS.GOV> Distribution: inet Date: 27 Jan 91 06:35:12 GMT Lines: 31 >>I am trying to make a main event handler which will run for at least >>the given time, and returns the control back to the program. >>That is, it should be a temparary XtAppMainLoop. >>I made up the following function: >> >>void TempEventH(XtAppContext app, unsigned int time) >>{ >> XEvent event; >> XtAppAddTimeOut(app, time, NULL, NULL); /* put up a timer event */ >> while(!(XtAppPending(app) & XtIMTimer)){ /* until it arrives */ >> XtAppNextEvent(app, &event); /* do the event processing */ >> XtDispatchEvent(&event); >> } >>} I might speak from ignorance, but I have the distinct impression (for many convoluted reasons) that timeouts are not handled how you may think. First, they are not an X event type (there is no "timeout" event down in real X, to my knowledget). I think rather that they must be dealt with by the mainloop, involving timeouts on selects and dispatching and so forth. My guess is that it is implimentation dependant, too. (It can't be unix alarm timeouts, either. For instance, System V unix doesn't handle timer subdivisions less than 1 second, whereas BSD unix does, so how would you get the subsecond accuracy in an X application on system V unless you user a special device driver or something -- which would be nearly ridiculous and I almost know they don't do it). I'd be interested in getting the real dope on how XtAppAddTimeOut type timeouts are (usually) implimentated. Please, anyone know?