From 1328aa33077fd1cf84869e366c82b8ea1d1abb5d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 31 Jan 2005 10:27:25 +0000 Subject: * Start of concurrent garbage collection. Processes write temporary roots to a per-process temporary file in /nix/var/nix/temproots while holding a write lock on that file. The garbage collector acquires read locks on all those files, thus blocking further progress in other Nix processes, and reads the sets of temporary roots. --- src/libstore/build.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/libstore/build.cc') diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 52bd08bb11a7..dbfde447e48b 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -13,6 +13,7 @@ #include "references.hh" #include "pathlocks.hh" #include "globals.hh" +#include "gc.hh" /* !!! TODO derivationFromPath shouldn't be used here */ @@ -59,7 +60,6 @@ protected: /* Whether amDone() has been called. */ bool done; - Goal(Worker & worker) : worker(worker) { done = false; @@ -442,6 +442,10 @@ void DerivationGoal::haveStoreExpr() /* Get the derivation. */ drv = derivationFromPath(drvPath); + for (DerivationOutputs::iterator i = drv.outputs.begin(); + i != drv.outputs.end(); ++i) + addTempRoot(i->second.path); + /* Check what outputs paths are not already valid. */ PathSet invalidOutputs = checkPathValidity(false); @@ -1308,6 +1312,8 @@ void SubstitutionGoal::init() { trace("init"); + addTempRoot(storePath); + /* If the path already exists we're done. */ if (isValidPath(storePath)) { amDone(); -- cgit 1.4.1