timeout handling



i'm new to the list and actually never wanted to be become a member.
however, on the gtk home page i couldn't find a way to report bugs or
sent comments.

anyway. i have a suggestion regarding the timeout handling. as you are
probably aware of, timeouts in gtk (actually in glib) are registered
with an interval value. that value is used to calculate the expiration
time of the the timeout. if the timeout expires, that is, if the current
time is greater or equal than the expiration time, the timeout callback
is triggered. that's the algorithm used.

that algorithm has one drawback. if the system clock gets set to a value
backwards in time, the timeout does not get triggered until the clock
has advanced to that time. my concrete problem is that apparently the
apm (advanced power management) daemon of redhat linux 6.0 screws up the
time for a short while after system resume. immediately after resume the
time is set to some value in the future before going back to now. in
that short while the timeout callback is called and the next timeout
expiration time set to a value in the far future. as a result the next
callback is not called within the interval. the same might be true if
the system clock is set manually (haven't tried).

so, what is the correct behavior? does an interval have a direction,
from past to future?
how about this algorithm:

save the time when the timeout is registered (rather than the expiration
time) and interval in the GTimeoutData. calculate the absolute value of
the difference of the current time and the set-time. if the value is
(equal or) greater than the interval, trigger the timeout. 

any suggestions?

cheers,
olli*

-- 
Oliver Kasten                  Voice: +41/ 1/ 63 20 663 Fax: 63 21 659
ETH-Zentrum, IFW D48.1                      E-Mail: kasten@inf.ethz.ch
CH-8092 Zuerich, Switzerland              WWW: www.inf.ethz.ch/~kasten



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]