threaded gtk apps / panel stability

Brian J. Tarricone bjt23 at cornell.edu
Fri Aug 13 04:13:22 CEST 2004


hi all-

i'm in las vegas now, and they have internet - ah, my withdrawl pains 
are subsiding (yes, i'm pathetic).  anyway, to the issue at hand....

On Wed, 11 Aug 2004, Jasper Huijsmans wrote:

> Benedikt Meurer wrote:
> > Jasper Huijsmans wrote:
> > 
> >> Hey all,
> >>
> >> There have been some stability problems with the panel that are possibly
> >> related to thread usage.
> >> A different approach to using threads with gtk apps is described here: 
> >> http://tiago.blogdns.org/gtk_threads.html
> >>
> >> Would that be something the panel could use, instead of all the
> >> gdk_thread_enter()/leave() stuff? No idea if it would be more robust. Any
> >> ideas? Brian, Benedikt?
> > 
> > 
> > Kinda nice trick to use g_idle_add()/g_timeout_add() to perform gui 
> > operations from other threads, tho I doubt that this will be easier to 
> > handle for panel plugins. I guess it will cause additional confusion for 
> > the panel plugin writer.
> > 
> 
> Only the ones using threads, right? This is how it should be, instead of 
> every plugin writer ;)

this is odd.  i don't think this page you're linking to is correct.  if 
you're using g_idle_add() or g_timeout_add() you MUST surround any 
gtk/gdk calls with gdk_threads_enter/leave() pairs.  glib timeout/idle 
functions aren't called inside the gdk lock, so....

and yes, this impacts every plugin writer - whether or not they use 
threads.

> > I tend to say 'lets drop the thread stuff from the panel again', it 
> > causes more problems and adds little value. Threaded GUI programming is 
> > always pain. The KDE people realized that years ago.
> > 
> 
> I was trying to avoid saying that, but that's my feeling exactly.

i have to agree...

> > On the other side I like to be able to use threads in panel plugins, but 
> > if we decide to keep the threaded panel we need to offer either a good 
> > document that describes the changes for plugin writers or we need a good 
> > panel API that hides the difficult stuff from the plugin writer (too 
> > late for 4.2 IMHO). Of course, having both things shouldn't hurt either :-)
> > 
> 
> void xfce_run_gui_function_from_thread (GSourceFunc function,
>                                          gpointer data)
> {
> 	g_idle_add (function, data);
> }
> 
> 
> Would that be enough? Combined with a little explanation/example, perhaps.

no, see what i said above...

	-brian




More information about the Xfce4-dev mailing list