best practice proposal: name locking and process exclusion

Lennart Poettering mzqohf at 0pointer.de
Thu Apr 7 11:29:23 PDT 2011


On Thu, 07.04.11 14:08, Colin Walters (walters at verbum.org) wrote:

> > I think the easiest solution would be to use a lock file in
> > XDG_RUNTIME_DIR:
> 
> I'm a fan of the runtime dir and think it makes sense, but like
> systemd it is very recent (not in Fedora 14 or RHEL 6 to be concrete),
> and I do have to consider people using a private backported GLib.  We
> could do if (!g_getenv ("XDG_RUNTIME_DIR")) { use_dbus_name_fallback()
> } - but I'm not seeing a compelling advantage of lock files over using
> a temporary dbus name as a lock anyways.

Well, but maybe it is sufficient in those cases to just log "Sorry man,
couldn't protect you from yourself, so don't run me twice
please."

> But this is an implementation detail - the real point I'm trying to
> get to is that it's best practice for components and apps to claim
> their DBus name late (or just asynchronously) and use another means
> (whether that's a lock file, separate dbus lock name, whatever) as an
> exclusion mechanism.

I think in general it should be fine to take only one name and that as
early as possible. The only problem with this scheme is if you run your
mainloop for a while before actually considering yourself started
up. But I'd guess that's actually the minority of apps?

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the dbus mailing list