weird gtk_timeout_add ...



Hmmm, the docs say the first parameter of gtk_timeout_add is the number
of milliseconds between successive events triggering the timeout handler.
So "gtk_timeout_add (10, check_progress, widget);" means call the handler
check_progress every 10ms. Now the handler has as the first lines
|  static int cnt=0;
|  printf("%d\n",cnt++);
So I'd expect counting to 1600 would take 1600 x 10ms = 16s. It doesn't.
It does take twice as long: 32s. Using a 20ms timeout, the total time is
still 50% longer than expected. The machine is not a particularly slow one,
and the result is independent of what else is done in the timeout handler. 
This is GTK 1.2.5. Any explanations ?

I'm sure my program has lots of memory leaks, because nowhere exists a
description of where I'd need to use g_free(). Is there a simple rule telling
which objects need to be g_freed ?


Cheers  Peter
-- 
---------------------------------------------------------------------
      Dr. Peter Rottengatter       peter rottengatter de
                                   http://www.rottengatter.de
---------------------------------------------------------------------






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