best practice proposal: name locking and process exclusion

Thiago Macieira thiago at kde.org
Thu Apr 7 18:45:18 PDT 2011


On Thursday, 7 de April de 2011 12:43:34 Colin Walters wrote:
> So one of the things I've always said about DBus that it provides for
> the operating system is a reliable means for loose binding between
> components, in the form of well-known bus names like
> org.freedesktop.NetworkManager.
> 
> Claiming a name serves multiple purposes:
> * Acts as a "process exclusion" mechanism, to avoid multiple processes
> in your component or app when not wanted (think in a classic GNOME 2
> desktop, where Firefox has to go out of its way to make clicking on
> the Firefox launcher multiple times work).
> * Allows other components or apps to communicate with you
> 
> The tension between these two is simply that for the first property,
> you want to claim the bus name *early*, before you start loading
> resource files and the like.  For the latter, you really only want to
> claim the bus name when your process is fully ready to respond to
> requests.

How about a hybrid:

Claim the name early, but don't start processing the input until you've 
finished loading. That usually means you can't spin the mainloop, but often 
initialisation work doesn't involve the mainloop, but instead loading plugins, 
registering objects, parsing input files, etc.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      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/20110407/8e76c89e/attachment.pgp>


More information about the dbus mailing list