Re: MainLoop & 100% CPU



Thank you friend. It worked out the problem :).. With a g_usleep(1000) , (under 1000 still eats 100%)..
Hoping that it won't decrease the execution speed significantly.. Anyway really weird bug..

Thank you again..

2007/11/22, Kuang-Chun Cheng <kcc1967 gmail com>:
I don't know what happened.   I saw the same problem as you which only
happen in glib win32 port.  Maybe a bug ??  But there is an easy fix ... just add an idle callback
which call g_usleep() regularly ... that fix the CPU issue for me.


KC

On Nov 22, 2007 9:31 PM, Ouanilo Jérôme Medegan < ouanilo pro gmail com> wrote:
Hi,

Newbie to GLib, i've began design a little program based on this library. The problem is that my proggie always eats 100% of CPU. I've then made a tiny prog just to isolate the problem and finally got this code as Main Function :

#include "windows.h"
#include "glib.h"

int WINAPI    WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
    GMainLoop    *MainLoop = NULL;

    MainLoop = g_main_loop_new(NULL, TRUE);
    g_main_loop_run(MainLoop);
}

Even this minimalist program eats 100% CPU. And i don't have any idea of what i'm doing wrong. So if there is something i've forgotten to do, please help me to understand :).
For information, i'm under Microsoft Visual Studio 2005 & using glib 2.12.9 (win32-dev)..

Thx for reading..

_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list





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