Why the gtk windows hangs?

Posted by httpinterpret on Stack Overflow See other posts from Stack Overflow or by httpinterpret
Published on 2010-05-09T12:52:48Z Indexed on 2010/05/09 12:58 UTC
Read the original article Hit count: 100

Filed under:
|
|
void forloop2()
{
    int i = 0;
    while(TRUE)
    {
        printf("forloop2\n");
    }
}

int main() {
    GtkWidget *window;
    g_thread_init(NULL);
    gdk_threads_init();
    g_thread_create((GThreadFunc)forloop2, NULL, FALSE, NULL);
    gtk_init(NULL, NULL);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_show_all (window);
    gtk_main();
}

It seems the created thread affects gtk_window_new(my programe hangs here),

how do I do it correctly?

© Stack Overflow or respective owner

Related posts about c

    Related posts about gtk