aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-31 10:27:25 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-31 10:27:25 +0000
commit1328aa33077fd1cf84869e366c82b8ea1d1abb5d (patch)
tree8f079aabcfb9d1d5b485170e0edb583c052039ee /src/libstore/store.cc
parenta7668411a10c79ad40c9c18caf2570d5c9f52182 (diff)
* 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.
Diffstat (limited to 'src/libstore/store.cc')
-rw-r--r--src/libstore/store.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc
index e676216c9..7c0faaf6c 100644
--- a/src/libstore/store.cc
+++ b/src/libstore/store.cc
@@ -12,6 +12,7 @@
#include "db.hh"
#include "archive.hh"
#include "pathlocks.hh"
+#include "gc.hh"
/* Nix database. */
@@ -468,6 +469,8 @@ Path addToStore(const Path & _srcPath)
string baseName = baseNameOf(srcPath);
Path dstPath = makeStorePath("source", h, baseName);
+ addTempRoot(dstPath);
+
if (!readOnlyMode && !isValidPath(dstPath)) {
/* The first check above is an optimisation to prevent
@@ -512,6 +515,8 @@ Path addTextToStore(const string & suffix, const string & s,
Path dstPath = makeStorePath("text", hash, suffix);
+ addTempRoot(dstPath);
+
if (!readOnlyMode && !isValidPath(dstPath)) {
PathSet lockPaths;