chiark / gitweb /
core: add Ref()/Unref() bus calls for units
authorLennart Poettering <lennart@poettering.net>
Mon, 15 Aug 2016 16:12:01 +0000 (18:12 +0200)
committerSven Eden <yamakuzure@gmx.net>
Wed, 5 Jul 2017 06:50:51 +0000 (08:50 +0200)
commit87a9605f2154237a49d3da054cad782dfcc1d2d2
treeee867e6a0e34b3e3b952fece851979ff59d4f006
parent11ec70371cc24612d14bb24ec9559b4f85e47de5
core: add Ref()/Unref() bus calls for units

This adds two (privileged) bus calls Ref() and Unref() to the Unit interface.
The two calls may be used by clients to pin a unit into memory, so that various
runtime properties aren't flushed out by the automatic GC. This is necessary
to permit clients to race-freely acquire runtime results (such as process exit
status/code or accumulated CPU time) on successful service termination.

Ref() and Unref() are fully recursive, hence act like the usual reference
counting concept in C. Taking a reference is a privileged operation, as this
allows pinning units into memory which consumes resources.

Transient units may also gain a reference at the time of creation, via the new
AddRef property (that is only defined for transient units at the time of
creation).
src/libelogind/sd-bus/bus-common-errors.c