src/Pure/Build/build_cluster.scala
changeset 79627 0f01c575ff3e
parent 79626 73b8ac4b0492
child 79632 463f94c504a4
--- a/src/Pure/Build/build_cluster.scala	Fri Feb 16 10:51:49 2024 +0100
+++ b/src/Pure/Build/build_cluster.scala	Fri Feb 16 11:12:42 2024 +0100
@@ -238,10 +238,10 @@
   def return_code(rc: Int): Unit = ()
   def return_code(res: Process_Result): Unit = return_code(res.rc)
   def return_code(exn: Throwable): Unit = return_code(Process_Result.RC(exn))
-  def open(): Unit = ()
-  def init(): Unit = ()
-  def benchmark(): Unit = ()
-  def start(): Unit = ()
+  def open(): Build_Cluster = this
+  def init(): Build_Cluster = this
+  def benchmark(): Build_Cluster = this
+  def start(): Build_Cluster = this
   def active(): Boolean = false
   def join: List[Build_Cluster.Result] = Nil
   def stop(): Unit = { join; close() }
@@ -284,7 +284,7 @@
 
   private var _sessions = List.empty[Build_Cluster.Session]
 
-  override def open(): Unit = synchronized {
+  override def open(): Build_Cluster = synchronized {
     require(_sessions.isEmpty, "build cluster already open")
 
     val attempts =
@@ -300,6 +300,8 @@
       for (case Exn.Res(session) <- attempts) session.close()
       error("Failed to connect build cluster")
     }
+
+    this
   }
 
 
@@ -307,7 +309,7 @@
 
   private var _init = List.empty[Future[Unit]]
 
-  override def init(): Unit = synchronized {
+  override def init(): Build_Cluster = synchronized {
     require(_sessions.nonEmpty, "build cluster not yet open")
 
     if (_init.isEmpty) {
@@ -319,9 +321,11 @@
           }
         }
     }
+
+    this
   }
   
-  override def benchmark(): Unit = synchronized {
+  override def benchmark(): Build_Cluster = synchronized {
     _init.foreach(_.join)
     _init =
       for (session <- _sessions if !session.host.shared) yield {
@@ -330,6 +334,8 @@
         }
       }
     _init.foreach(_.join)
+
+    this
   }
 
 
@@ -339,7 +345,7 @@
 
   override def active(): Boolean = synchronized { _workers.nonEmpty }
 
-  override def start(): Unit = synchronized {
+  override def start(): Build_Cluster = synchronized {
     require(_sessions.nonEmpty, "build cluster not yet open")
     require(_workers.isEmpty, "build cluster already active")
 
@@ -352,6 +358,8 @@
           Exn.release(capture(session.host, "work") { session.start() })
         }
       }
+
+    this
   }
 
   override def join: List[Build_Cluster.Result] = synchronized {