dbus_g_thread_init()

John (J5) Palmieri johnp at redhat.com
Wed Sep 13 10:15:51 PDT 2006


On Wed, 2006-09-13 at 12:19 -0400, Havoc Pennington wrote:
> John (J5) Palmieri wrote:
> > While your frustration is understandable your solution is not well
> > thought out.  Part of the problem is documentation which we do need to 
> > work on.  The real solution here is making threading evident to even
> > those who don't use it but may in the future.  I got a lot of pushback
> > from suggesting we turn on threads full time.  And no it was not from
> > zealots.
> 
> Did they know about dbus_thread_disable() or whatever that was also in 
> alex's patch? (btw that patch is still outstanding, is it blocking on me 
> in some way?)
> 
> What were the objections?

My current objects are API and semantic changes.  I agreed to alex's
patch for an init_threads_default to avoid the API change.  It is so
late in the game if we do want to initalize threads we would have to
make threads_init a noop.  

> > The idea is to have a public dbus_g_init(gboolean is_threaded) function.
> > Most libraries have an init function so this is fine and we need it
> > anyway since the type system is currently initialized by dbus_g_bus_get
> > and there are instances where you need to use dbus types before you get
> > a connection.
> 
> I think this is kind of a downgrade; init functions are in general evil 
> (I consider g_type_init() a design bug)

We still need it for specialized types.  There have been many a
scratched head on why D-Bus GLib calls weren't working that finally came
down to types weren't initialized because dbus_g_bus_get wasn't called
yet.  It is easier to spot that someone didn't call the init function.

In any case if use Alex's patch, make dbus_threads_init a noop and turn
on threading by default means I can take the recursive mutex TODO off
(since it is internal), I'll be happy with that.  If it means pulling
out a heap of code, changing API and upping the soname I don't think it
is worth it.

The other issue to consider is that D-Bus is deployed so widely now that
this change will inevitably lead to:

#ifdef DBUS_VERSION >= 0.93
dbus_threads_disable
#endif

if people care all that much.  Not a big issue but I know I'm not going
to hear the end of it for some time. But that should figure into this
change if it is the right thing to do before 1.0.

-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list