weird ut_unixTimer behaviour...

Subject: weird ut_unixTimer behaviour...
From: Joaquín Cuenca Abela (
Date: Sun Mar 18 2001 - 13:40:42 CST

I've been looking at the ut_unixTimer behaviour, and I've find that:

When the timer fires up, it call the function _Timer_Proc, which in
turn, calls the real callback. After that, it performs a
"resetIfStarted" (which creates a new one with the same period), and
then [_Timer_Proc] finish returning 0 (which destroy the first timer).

So, in short, each time that a timer is fired, we are recreating &
destroying a timer.

That, along with some problems in the way that we managed the timer
id's, prevent us for doing that:

UT_Timer *timer = UT_Timer::static_constructor(callback, data);
int id = timer->getIdentifier();
UT_ASSERT(timer == UT_Timer::findTimer(id)); // This line will stop the

furthermore, if we save id, and we don't save "timer", and we try to do
something like:

UT_Timer *timer = UT_Timer::findTimer(id);

timer will be NULL.

Is it intended behaviour?
I don't think so. I will send a patch (as soon as I fix the bugs the
Jesper found in the autosave stuff) to fix it. If somebody has further
comments, please speak up.


Joaquín Cuenca Abela

This archive was generated by hypermail 2b25 : Sun Mar 18 2001 - 13:41:33 CST