Stopping the d-bus daemon when the last connection closes

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Aug 23 02:06:57 PDT 2011


On Tue, 23 Aug 2011 at 10:10:15 +0200, Thomas Sondergaard wrote:
> Now, when my
> application is closed by the user all my processes go away, but the
> dbus-daemon.exe lingers. I'd like it to go away when the last client
> disconnects or briefly after.

This would be a nice thing to have, but watch out for race conditions (e.g. a
new connection appears just as dbus-daemon decides it's going to exit).
You'd probably need specific integration with the named mutex that D-Bus on
Windows uses for autolaunch.
https://bugs.freedesktop.org/show_bug.cgi?id=11454 is vaguely related.

> Is there a way to get that behaviour now?

Not currently, but if someone (you?) wrote it (and provided a convincing
explanation of how the race condition mentioned above was avoided), I'd be
happy to review it.

Ideally, you'd also want a way for connections to mark themselves as "daemon"
processes that don't prevent the dbus-daemon from exiting (so it exits when
it has no non-daemon connections).

    S


More information about the dbus mailing list