Question about threads



Hello,

I need some clarification here. 

I have an application that spawns a couple of threads and I thought all
was going well until I compiled it on a sparcserver 20 running Solaris
8. The application runs fine but hangs on the "Cancel" buttons from any
dialog box. Very strange, it works perfectly under Linux with the same
version of Gtk+ and Glib, etc. 

I did some backtracking and found the cause for it hanging.

The FAQ  http://www.gtk.org/faq/#AEN473 shows using the following
setup when you want to use threads:  

int main (int argc, char *argv[])
{
GtkWidget *window;

  g_thread_init(NULL); 

  ....snip...

   gdk_threads_enter();
   gtk_main();
   gdk_threads_leave();

 return(0);
}

However when I comment out the three statements which are direcly
related to threads:

g_thread_init(NULL); 
gdk_threads_enter();
gdk_threads_leave();

the program compiles and runs fine on the sparcserver. So I guess
I'm wondering if these statements are needed at all. Will something
evil happen that I'm not running into without them?  My threads are
really pretty simple with regards to shared data, but that could change
in the future. Is this something I need to worry about or is there
something else I need to look for on Solaris that is causing the
conflict.

Thanks,
Mike




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