void forloop2()
{
int i = 0;
while(TRUE)
{
printf("forloop2\n");
}
}
int main() {
GThread *Thread1;
GtkWidget *window;
g_thread_init(NULL);
gdk_threads_init();
gdk_threads_enter ();
Thread1 = g_thread_create((GThreadFunc)forloop2, NULL, TRUE, NULL);
gtk_init(NULL, NULL);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show_all (window);
gtk_main();
g_thread_join(Thread1);
gdk_threads_leave ();
}
When I close the window, how to make Thread1
also exit?