Re: Stalls in idle loop



On Fri, 11 Aug 2000, Vlad Harchev wrote:

>  So report their values here. Also it would be nice if you've said what OS do
> you use, kernel version (that can matter if it's very ancient), and a version
> of X too.

Ok, so I am running Red Hat Linux 6.2 (Zoot) with kernel 2.2.14-5.0 on an
i686.  My GTK version is 1.2.6.  I presume I'm using Xfree86 X11R6.3.

>   What signal - it is OS signal like SIGUSR1? Or is it timeout function?

SIGUSR2, actually. I can't figure out how to tell gdb to run my program
normally, and not halt on signals.  The continue command with a numeric
argument seems to only work with breakpoints.  In any case, what I have
done is run my program until the bug/feature manifests itself, and the
attach gdb to the process and print out a stack trace.  I did this four
times. Invariably, I get something that looks like this:

#0  0x4031d17e in __select () from /lib/libc.so.6
#1  0x40251dd8 in ?? () from /usr/X11R6/lib/libX11.so.6
#2  0x401e18f8 in _XRead () from /usr/X11R6/lib/libX11.so.6
#3  0x401e135d in _XEventsQueued () from /usr/X11R6/lib/libX11.so.6
#4  0x401d58ea in XPending () from /usr/X11R6/lib/libX11.so.6
#5  0x40153359 in gdk_event_prepare () from /usr/lib/libgdk-1.2.so.0
#6  0x4018349a in g_main_iterate () from /usr/lib/libglib-1.2.so.0
#7  0x401838f1 in g_main_run () from /usr/lib/libglib-1.2.so.0
#8  0x400a85b9 in gtk_main () from /usr/lib/libgtk-1.2.so.0
#9  0x8055453 in main ()
#10 0x402889cb in __libc_start_main (main=0x8055260 <main>, argc=1, 
    argv=0xbffffaa4, init=0x804a084 <_init>, fini=0x805577c <_fini>, 
    rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbffffa9c)
    at ../sysdeps/generic/libc-start.c:92

On Sat, 12 Aug 2000, Naba Kumar wrote:

> I don't think this a problem, beacause it is the inherent property of
> the implementation. Gtk has no idea how many times it should call your
> function when it becomes idle. That's why (I suppose) it is called only
> once :-).

It seems to me that it should continue to run your function as long as it
is idle, and your function should be smart enough to know when it should
be working and when it should not. You are correct that the idle function
shouldn't take a long time to run, but I expected that the process should
be: run the function, handle any pending events, run the function, handle
any pending events, etc.  It doesn't seem right for the number of times
your idle function is run to depend on how many redraw requests or
whatever events your program gets.  In any case, that is probably not the
problem here.  Adding the idle function more than once makes the problem
_more likely_ to occur.

Nick Matsakis






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