tuned signature;
authorwenzelm
Tue, 21 Feb 2023 12:48:22 +0100
changeset 77335 05b97b54cb3b
parent 77334 0231e62956a6
child 77336 e9beaaf955bf
tuned signature;
src/Pure/Tools/build_process.scala
--- a/src/Pure/Tools/build_process.scala	Tue Feb 21 12:42:08 2023 +0100
+++ b/src/Pure/Tools/build_process.scala	Tue Feb 21 12:48:22 2023 +0100
@@ -172,7 +172,7 @@
     running: Map[String, Build_Job] = Map.empty,
     results: Map[String, Build_Process.Result] = Map.empty
   ) {
-    def is_pending: Boolean = pending.nonEmpty
+    def finished: Boolean = pending.isEmpty
 
     def remove_pending(name: String): State =
       copy(pending = pending.flatMap(
@@ -248,7 +248,7 @@
       (for ((name, (_, (preds, _))) <- build_context.sessions_structure.build_graph.iterator)
         yield Build_Process.Entry(name, preds.toList)).toList)
 
-  protected def is_pending(): Boolean = synchronized { _state.is_pending }
+  protected def finished(): Boolean = synchronized { _state.finished }
 
   protected def next_pending(): Option[String] = synchronized {
     if (_state.running.size < (build_context.max_jobs max 1)) {
@@ -428,8 +428,12 @@
     }
 
   def run(): Map[String, Process_Result] = {
-    if (is_pending()) {
-      while (is_pending()) {
+    if (finished()) {
+      progress.echo_warning("Nothing to build")
+      Map.empty[String, Process_Result]
+    }
+    else {
+      while (!finished()) {
         if (progress.stopped) stop_running()
 
         for (job <- finished_running()) finish_job(job)
@@ -443,9 +447,5 @@
         for ((name, result) <- _state.results) yield name -> result.process_result
       }
     }
-    else {
-      progress.echo_warning("Nothing to build")
-      Map.empty[String, Process_Result]
-    }
   }
 }