Stopping the d-bus daemon when the last connection closes

Thiago Macieira thiago at kde.org
Tue Aug 23 01:46:36 PDT 2011


On Tuesday, 23 de August de 2011 10:10:15 Thomas Sondergaard wrote:
> I wrote a message to the mailing list a few weeks ago about getting the
> dbus-daemon to exit when the last client disconnects, but I didn't get
> an answer. Not sure if the tone in my message was impolite, or the
> request stupid, but I thought I'd try again.

I don't remember seeing it, but now that I look for it, I can see it.

Auto-exit-on-last-disconnect is also one of the things I mentioned in the 
Desktop Summit, except I called it "suicide mode".

> I have an MS-Windows application (originally born on Linux) that uses
> D-bus for communication between processes. On Windows the default
> autolaunch: address causes a dbus-daemon to be created that is shared
> with the desktop-session. This means a useful bus pops into existence
> the first time you need it - very nice. 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.
> 
> Is there a way to get that behaviour now? I imagine this would be useful
>   on Windows in general.

It's possible to get it, even on Linux. But it needs to be done very carefully 
to avoid race conditions: what if an application decides to start at the very 
moment that the bus decides to exit?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20110823/14f28406/attachment.pgp>


More information about the dbus mailing list