about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-06-22T09·00+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-06-22T09·00+0000
commit155d7c8dfa46da054beaf37d6415d52613e2bb17 (patch)
treeff4ddf52b5fa97c2c94ade89f1ba4ab9d1ef3db1
parentc4cb6ea2bc77f1f9239ce81ffc7a0fa6b540b1ab (diff)
* Substitutes should occupy a build slot.
-rw-r--r--src/libstore/normalise.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/libstore/normalise.cc b/src/libstore/normalise.cc
index 29a6c339cb15..5d68945b07f7 100644
--- a/src/libstore/normalise.cc
+++ b/src/libstore/normalise.cc
@@ -1218,6 +1218,7 @@ public:
     void tryNext();
     void exprNormalised();
     void exprRealised();
+    void tryToRun();
     void finished();
 };
 
@@ -1302,6 +1303,19 @@ void SubstitutionGoal::exprRealised()
 {
     debug(format("store expr realised of `%1%'") % storePath);
 
+    state = &SubstitutionGoal::tryToRun;
+    worker.waitForBuildSlot(shared_from_this());
+}
+
+
+void SubstitutionGoal::tryToRun()
+{
+    /* Make sure that we are allowed to start a build. */
+    if (!worker.canBuildMore()) {
+        worker.waitForBuildSlot(shared_from_this());
+        return;
+    }
+
     /* What's the substitute program? */
     StoreExpr expr = storeExprFromPath(nfSub);
     assert(expr.type == StoreExpr::neClosure);
@@ -1390,7 +1404,7 @@ void SubstitutionGoal::exprRealised()
     /* parent */
     logPipe.writeSide.close();
     worker.childStarted(shared_from_this(),
-        pid, logPipe.readSide, false);
+        pid, logPipe.readSide, true);
 
     state = &SubstitutionGoal::finished;
 }