gtk_events_pending() seems to spin sometimes?

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

 



Hi.

I have a loop that looks like this...

while( gtk_events_pending () )
{
    printf("%s: will do: gtk_main_iteration ", __FUNCTION__);
    gtk_main_iteration ();
}


If I understand right, that should be pretty standard GTK+ code.  Sometimes
when my program hits this loop, gtk_events_pending() blocks forever and
my application starts using all the cpu cycles.  If I attach to it with
gdb I get a back trace that looks something like this:

(gdb) bt
#0  0x408174b8 in select () from /lib/tls/libc.so.6
#1  0x408acb00 in _XGetAsyncData () from /usr/X11R6/lib/libX11.so.6
#2  0x408ad2d2 in _XFlush () from /usr/X11R6/lib/libX11.so.6
#3  0x408ad0e7 in _XFlush () from /usr/X11R6/lib/libX11.so.6
#4  0x408ad84b in _XEventsQueued () from /usr/X11R6/lib/libX11.so.6
#5  0x408a0a59 in XPending () from /usr/X11R6/lib/libX11.so.6
#6  0x403382b2 in gdk_check_xpending (display=0x1) at gdkevents-x11.c:147
#7  0x4033a93f in gdk_event_prepare (source=0x1, timeout=0x1) at gdkevents-x11.c:2183
#8  0x40464448 in IA__g_main_context_prepare (context=0x80c6520, priority=0xbfffd734) at gmain.c:2265
#9  0x40464dd6 in g_main_context_iterate (context=0x80c6520, block=0, dispatch=0, self=0x80d2cf0) at gmain.c:2558
#10 0x404650f9 in IA__g_main_context_pending (context=0x80c6520) at gmain.c:2606
#11 0x4014415f in IA__gtk_events_pending () at gtkmain.c:1036
...


I imagine select() doesn't block too long because my program is keeping
the cpu so busy.  Is it possible I'm screwing up my environment somehow
that's causing this breakage?  Am I using gtk_events_pending()
incorrectly?  What should I look for?

Thanks a lot!

- Ben

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux