On 11/27/2013 12:59 PM, David Buchan wrote:
> Hi Michael,
> 
> My 32-bit, GTK+2 version does
> 
>   // Secure glib
>   if (!g_thread_supported ()) {
>     g_thread_init (NULL);
>   }
> 
> at the beginning, and then the thread is spawned via:
> 
> on_button1_clicked (GtkButton *button1, MyData *data)
> {
>   GThread *thread;
>   GError *error = NULL;
> 
>   thread = g_thread_create ((GThreadFunc) my_function, data, FALSE, &error);
>     if (! thread) {
>       g_print ("Error: Unable to create new thread for my_function() in 
> on_button1_clicked().%s\n", error->message);
>       exit (EXIT_FAILURE);
>     }
> 
> My 64-bit, GTK+3 versions does not do the g_thread_init() call.
> 
> It spawns a new thread via:
> 
> int
> on_button1_clicked (GtkButton *button1, MyData *data)
> {
>   GThread *thread;
> 
>   thread = g_thread_new ("my_function", (GThreadFunc) my_function, data);
>     if (! thread) {
>       fprintf (stderr, "Error: Unable to create new thread for my_function() 
> in on_button1_clicked().\n");
>       exit (EXIT_FAILURE);
>     }
> 
> These threads do nothing with the GUI.

It occurs to me that the problem could just be that standard out is
buffered, so you don't see anything until the buffer is flushed.  Maybe
you can try to flush standard out after the printf (or g_print).
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to