On Sat, 2013-07-20 at 04:14 +0800, Gang Chen wrote: > Because the idle callback always returns TRUE, the idle callback is > called again and again, and CPU usage is 100%. > > The idle callback doesn't do any heavy processing. > > > Regarding this problem, doing central updating when idle is simpler > than using signals to update. In the thread that normally runs g_main_loop_run(), use instead: while (<keep running>) { g_main_context_iteration(NULL, TRUE); /* block */ <your idle code here> } Because g_main_context_iteration() is allowed to block when there is nothing to do, you avoid the 100% CPU consumption. If there was something to do, your code gets called. -- Best Regards, Patrick Ohly The content of this message is my personal opinion only and although I am an employee of Intel, the statements I make here in no way represent Intel's position on the issue, nor am I authorized to speak on behalf of Intel on this matter. _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx https://mail.gnome.org/mailman/listinfo/gtk-list