src/Pure/Tools/build.scala
changeset 62572 acd17a6ce17d
parent 62569 5db10482f4cf
child 62573 27f90319a499
equal deleted inserted replaced
62571:2fd90993a928 62572:acd17a6ce17d
   603       fi
   603       fi
   604 
   604 
   605       exit "$RC"
   605       exit "$RC"
   606       """
   606       """
   607 
   607 
   608     private val result =
   608     private val future_result =
   609       Future.thread("build") {
   609       Future.thread("build") {
   610         Isabelle_System.bash(script, info.dir.file, env,
   610         Isabelle_System.bash(script, info.dir.file, env,
   611           progress_stdout = (line: String) =>
   611           progress_stdout = (line: String) =>
   612             Library.try_unprefix("\floading_theory = ", line) match {
   612             Library.try_unprefix("\floading_theory = ", line) match {
   613               case Some(theory) => progress.theory(name, theory)
   613               case Some(theory) => progress.theory(name, theory)
   619               case m => Some(m * 1000000L)
   619               case m => Some(m * 1000000L)
   620             },
   620             },
   621           strict = false)
   621           strict = false)
   622       }
   622       }
   623 
   623 
   624     def terminate: Unit = result.cancel
   624     def terminate: Unit = future_result.cancel
   625     def is_finished: Boolean = result.is_finished
   625     def is_finished: Boolean = future_result.is_finished
   626 
   626 
   627     @volatile private var was_timeout = false
   627     @volatile private var was_timeout = false
   628     private val timeout_request: Option[Event_Timer.Request] =
   628     private val timeout_request: Option[Event_Timer.Request] =
   629     {
   629     {
   630       if (info.timeout > Time.zero)
   630       if (info.timeout > Time.zero)
   632       else None
   632       else None
   633     }
   633     }
   634 
   634 
   635     def join: Process_Result =
   635     def join: Process_Result =
   636     {
   636     {
   637       val res = result.join
   637       val result = future_result.join
   638 
   638 
   639       if (res.ok && !is_pure(name))
   639       if (result.ok && !is_pure(name))
   640         Present.finish(progress, browser_info, graph_file, info, name)
   640         Present.finish(progress, browser_info, graph_file, info, name)
   641 
   641 
   642       graph_file.delete
   642       graph_file.delete
   643       args_file.delete
   643       args_file.delete
   644       timeout_request.foreach(_.cancel)
   644       timeout_request.foreach(_.cancel)
   645 
   645 
   646       if (res.interrupted) {
   646       if (result.interrupted) {
   647         if (was_timeout) res.error(Output.error_text("Timeout")).was_timeout
   647         if (was_timeout) result.error(Output.error_text("Timeout")).was_timeout
   648         else res.error(Output.error_text("Interrupt"))
   648         else result.error(Output.error_text("Interrupt"))
   649       }
   649       }
   650       else res
   650       else result
   651     }
   651     }
   652   }
   652   }
   653 
   653 
   654 
   654 
   655   /* inlined properties (YXML) */
   655   /* inlined properties (YXML) */