Re: Stalls in idle loop

On Mon, 14 Aug 2000, Nick Matsakis wrote:

> 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

 Use 'handle' command for that (and 'help' for help :).

> 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/
> #1  0x40251dd8 in ?? () from /usr/X11R6/lib/
> #2  0x401e18f8 in _XRead () from /usr/X11R6/lib/
> #3  0x401e135d in _XEventsQueued () from /usr/X11R6/lib/
> #4  0x401d58ea in XPending () from /usr/X11R6/lib/
> #5  0x40153359 in gdk_event_prepare () from /usr/lib/
> #6  0x4018349a in g_main_iterate () from /usr/lib/
> #7  0x401838f1 in g_main_run () from /usr/lib/
> #8  0x400a85b9 in gtk_main () from /usr/lib/
> #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

  I can't say something certain on this. Granted, this is not a gtk/gdk bug
IMO, but some problem/bug with Xlib (I think). I hope someone from
gtk-devel-list see this and examine the problem.

> 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.

 As for hackish ways for solving the problem, I would recommend the following:
Could you add a timeout function that does nothing but is invoked very often?

> Nick Matsakis

 Best regards,

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