RE: Does gtk have issues with STL?



> Interesting. So g_idle_add can be safely called 
> from a different thread? Does it have to be a gthread, 
> or will a pthread work as well?

I have been using pthreads with g_idle_add for a few years.  It seems to
work fine.  Just make sure you call g_thread_init(NULL) before
gtk_main().

> I've added gdk_threads_enter/leave around all my calls, 
> and so far as I can tell, everything appears to be fine now.

I can say that on Solaris 9 with GTK 2.1.0 there are definitely subtle,
yet serious bugs in the "thread aware" functionality that enter/leave
offers.  On a large project, it took us a few months to realize that it
wasn't working.  One problem in particular was that GtkTreeView updates
done from an alternate thread sometimes got mangled or core dumped.  We
gave up on the enter/leave calls and started using g_idle_add.  Random
problems went away, and our design was greatly improved.  However, the
enter/leave bugs may have been fixed since 2.1.0.

-Anthony Vallone


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