race-free exit-on-idle (redux)

Colin Walters walters at verbum.org
Wed May 13 11:10:25 PDT 2015


Regarding: https://bugs.freedesktop.org/show_bug.cgi?id=11454
(But posting here as I spend too much of my life waiting for
 Bugzilla instances - we can summarize there after, link to this thread)

We were talking about having a daemon for rpm-ostree in

I would like to not have a persistent in memory daemon, for a variety
of reasons.

Now several systemd services do exit-on-idle.  I dug into how that's
supposed to work (mainly via `sd_notify("STOPPING=1")` ), and came up
with this example of a (hopefully) standalone race-free stateful service:


Now...is this actually race free?  There are a lot of subtleties involved
here, so I'd like to tap the collective brainpower here - was
 sd_notify(STOPPING=1) and the fact that systemd can track process
state and ensure there's only one, synchronized with the bus name
ownership the missing piece on top of the designs in https://bugs.freedesktop.org/show_bug.cgi?id=11454

More information about the dbus mailing list