threaded gtk apps / panel stability

Jasper Huijsmans jasper at xfce.org
Wed Aug 11 08:13:26 CEST 2004


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 ;)

> 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.

> 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.

Seems so much simpler than constantly locking/unlocking threads that I 
can't believe it will really work ...

	Jasper



More information about the Xfce4-dev mailing list