thread-safety

Havoc Pennington hp at redhat.com
Wed Dec 14 21:03:03 PST 2005


On Tue, 2005-12-13 at 18:09 -0500, John (J5) Palmieri wrote:
> I would get private connections for each thread (dbus_bus_get_private)
> works the same as dbus_bus_get but doesn't share the connection.
> 

I wouldn't do that in general; the main point of dbus_bus_get() is so
that all the various libs and modules an app uses don't have to each
have their own socket open to the bus... i.e. the connection to the bus
is intended to be shared. It may be that for some specific gnome-vfs
context it makes sense to do a private connection (if you were opening a
connection only temporarily, for example). If you're opening a
connection in every gnome app and keeping it open while the app is
running, I'd try to use the shared one though.

Using a private connection avoids some but not all potential thread bugs
in libdbus. There are also global static variables and things that
require locking.

Havoc




More information about the dbus mailing list