[systemd-devel] [PATCHv2] core: do not spawn jobs or touch other units during coldplugging
Lennart Poettering
lennart at poettering.net
Fri Apr 24 07:43:18 PDT 2015
On Fri, 24.04.15 17:23, Ivan Shapovalov (intelfx100 at gmail.com) wrote:
> I think I agree with this idea. I just didn't know how to handle
> potentially unbounded recursion. Maybe we can do something along these
> lines (pseudocode):
>
> while (any units left to coldplug)
> for (unit in hashmap)
> if (not yet marked)
> if (all deps of unit are coldplugged)
> coldplug_and_mark(unit);
>
> That is, we will repeatedly loop over hashmap, coldplugging only those
> units whose UNIT_TRIGGERS are already coldplugged, and leaving other
> units for next outer iteration.
Well, I just made the recursion a real recursion:
in unit_coldplug(u):
if (u.coldplugged)
return;
u.coldplugeged = true;
foreach (x in u.triggers):
unit_coldplug(x);
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list