Providing several well-known names vs. activation

Havoc Pennington hp at
Mon May 16 12:39:13 PDT 2011


On Mon, May 16, 2011 at 4:52 AM, Sascha Silbe
<sascha-ml-reply-to-2011-2 at> wrote:
> My problem is how to teach the D-Bus daemon that both bus names are
> provided by the same process, in order to prevent race conditions on
> start-up (if both bus names are contacted and thus auto-activated in
> quick succession). D-Bus has an internal queue of services that are in
> the process of getting activated (exactly to prevent race conditions),
> but my reading of the source suggests it only works for a single bus
> name per activation.

What should happen I think is that dbus launches your executable twice
(once per name), but then your executable should require owning one of
the names to keep running. So the second launch of the executable
should fail to obtain the bus name you're using to "lock", and just
exit. The first launch of the executable should end up with both
names. And then dbus should be happy.

Don't know if that already works but I would think it should, or with
some tweaks to the basic idea.

It's a little inefficient but only in the somewhat unusual case that
someone tries to activate both names at almost exactly the same time,
so that seems fine.


More information about the dbus mailing list