Changing threading semantics from init early to init before second thread

Havoc Pennington hp at redhat.com
Mon Aug 14 14:19:07 PDT 2006



Andy Wingo wrote:
> On Mon, 2006-08-14 at 11:23 -0400, John (J5) Palmieri wrote:
>> With Gnome-VFS (and mozilla) being an issue these days in terms of
>> making non-threaded apps threaded and killing D-Bus in the process would
>> it be possible to fix the internals to be able to init before the second
>> thread is started?
> 
> Stupid question: why not just always operate in a threadsafe mode?
> Uncontended mutexen are cheap.
> 

There's no real problem with that (it's detectable but not significant 
in the profile). The reason dbus_init_threads() exists is to avoid 
maintaining a Windows/UNIX thread abstraction in dbus itself, and just 
use the ones in GLib, Qt, etc. Secondarily, to let people install 
special thread implementations for debugging purposes or whatever.
But mostly to avoid having a thread abstraction in dbus itself.

It may well be kind of pointless, as the simple operations dbus needs do 
not necessarily take a lot of abstraction; dbus does not need to create 
threads for example.

Havoc



More information about the dbus mailing list