Re: g_idle_add(): limits?
- From: Chris Vine <chris cvine freeserve co uk>
- To: "fkater googlemail com" <fkater googlemail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: g_idle_add(): limits?
- Date: Thu, 11 Mar 2010 13:06:36 +0000
On Wed, 10 Mar 2010 15:10:50 +0100
"fkater googlemail com" <fkater googlemail com> wrote:
Chris Vine:
I make heavy use of g_idle_add(), and encounter this problem:
It seems that the idle functions aren't called sometimes.
[...]
Assuming that is right, any sources you add before calling
gtk_main_quit() without returning control to the main loop will not
be executed. I think it probably also means that if you call
gtk_main_quit() in a GTK+ signal handler, which will have a higher
priority than a default idle event, a stacked idle callback will
also not be called (that depends on what the documentation that I
have referred to means by "dispatched").
This might be the case here: I am definitly not calling
gtk_main_quit() too early, since I am sleeping in a loop
before calling it, waiting for my "pending idle function
counter" to become 0 (but it doesn't sometimes as
mentioned). However, the locking situation here really
prevents giving GTK+ back control while waiting.
I assume this is the problem (since not occuring always I
can not yet say definitly this was the cause, though).
You could test it by running 'while (gtk_events_pending())
gtk_main_iteration();' immediately before the call to gtk_main_quit(),
(or you could call 'while (g_main_context_pending(NULL))
g_main_context_iteration(NULL, FALSE)'). In either case, make it
absolutely the last thing that is done before gtk_main_quit().
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]