Merge pull request #105 from neonichu/do-not-spawn-after-cancellation

Do not execute new processes anymore after cancel
diff --git a/lib/BuildSystem/LaneBasedExecutionQueue.cpp b/lib/BuildSystem/LaneBasedExecutionQueue.cpp
index 93ecbcc..8977150 100644
--- a/lib/BuildSystem/LaneBasedExecutionQueue.cpp
+++ b/lib/BuildSystem/LaneBasedExecutionQueue.cpp
@@ -209,6 +209,14 @@
                  ArrayRef<StringRef> commandLine,
                  ArrayRef<std::pair<StringRef,
                                     StringRef>> environment) override {
+    {
+      std::unique_lock<std::mutex> lock(readyJobsMutex);
+      // Do not execute new processes anymore after cancellation.
+      if (cancelled) {
+        return false;
+      }
+    }
+
     // Assign a process handle, which just needs to be unique for as long as we
     // are communicating with the delegate.
     struct BuildExecutionQueueDelegate::ProcessHandle handle;