Re: g_idle_add(): limits?



On Tue, Mar 09, 2010 at 10:06:19AM +0100, fkater googlemail com wrote:
I make heavy use of g_idle_add(), and encounter this problem:
It seems that the idle functions aren't called sometimes.

To track that: I used a counter before g_idle_add() and one
inside the idle function (always executed once only).  When
the app is closed, the counters are sometimes not equal.

I can't explain this but

(1)
Is there in general a chance that g_idle_add() does NOT call
the idle function?

Should and can I check if it returns 0 (=error?). This is
not made so clear by the doc.

It returns zero only in can't-happen situations, in any case you would
CRITICAL errors printed to the console.  So, no.

(2)
What would glib/gtk do if it was flooded with more idle
functions than there is idle time?

I have seen gtk working and responding properly with 2500
idle functions (!) here, but I wonder if there might be a
maximum for pending idle functions.

There is no hard limit.  If the idle functions take too much time (a
single runaway idle function can manage that) the program becomes
unresponsive.

Pending idle functions might not be executed if you terminate the main
loop.  Is this your problem?  Track the source ids or other unique
identifiers and you will see which idle functions are not executed.

Yeti




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