Debabrata Debroy wrote: > I have written Following program so that fun() gets called by every 10 mili > seconds.But after executing the program I Found its calling the function > after 20 mili seconds.If I specify timeinterval as 20 mili second in > XtAppAddTimeOut function its calling fun method after 30 mili seconds.
I don't believe there's any guarantee on XtAppAddTimeOut returning after exactly the number of milliseconds specified - especially on busy systems it may take longer than that to get scheduled again. I suspect what you're seeing is simply the effect of the system timer resolution being 10 ms by default. Since your code takes a non-zero amount of time to run, by the time it's complete, waiting for at least 20ms puts you to the tick that's 30ms after when you started: start + 0ms: Previous timeout expires, scheduler queues your process to run, XtAppMainLoop searches timeouts to see what's up, finds your timer has expired and calls your callback function start + 0.1ms?: Your code starts running start + 0.2ms?: Your code sets a timeout to occur in 20ms, which would be start + 20.2ms, so it's scheduled for the first tick after that, which would be start + 30ms. You can probably find other people running into this with select()/poll(), certainly I've found bugs in the database that they filed and were closed as "Not a bug". I believe Linux defaults to a higher resolution timer, something you can enable system-wide on Solaris, but if you're shipping this code to customers, forcing them to modify it on all their systems is not a very good plan. If your app is so timing senstive that 10ms makes a difference, you probably want to use a more modern/supported API than libXt for your timeouts. Xt is only recommended when using a legacy toolkit such as Motif these days. BTW, this is all from memory & a quick glance at the bug database - if you want someone to actually investigate, you should open a support call, not rely on a post to a free discussion forum. -- -Alan Coopersmith- alan.coopersm...@oracle.com Oracle Solaris Platform Engineering: X Window System _______________________________________________ opensolaris-discuss mailing list opensolaris-discuss@opensolaris.org