Re: Stalls in idle loop

Nick Matsakis <> writes: 
> #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

This is just your app sitting in select() waiting for X
events. Standard normal stuff.
> 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.

Does your idle function return TRUE? If it returns FALSE it will be
removed. If it returns void then random junk will be returned,
sometimes TRUE and sometimes FALSE.


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