src/Pure/System/session.scala
changeset 45158 db4bf4fb5492
parent 45076 dd803d319d5b
child 45248 3b7b64b194ee
equal deleted inserted replaced
45157:efc2e2d80218 45158:db4bf4fb5492
   135   }
   135   }
   136 
   136 
   137 
   137 
   138   /* actor messages */
   138   /* actor messages */
   139 
   139 
   140   private case class Start(timeout: Time, use_socket: Boolean, args: List[String])
   140   private case class Start(timeout: Time, args: List[String])
   141   private case object Cancel_Execution
   141   private case object Cancel_Execution
   142   private case class Init_Node(name: Document.Node.Name,
   142   private case class Init_Node(name: Document.Node.Name,
   143     header: Document.Node_Header, perspective: Text.Perspective, text: String)
   143     header: Document.Node_Header, perspective: Text.Perspective, text: String)
   144   private case class Edit_Node(name: Document.Node.Name,
   144   private case class Edit_Node(name: Document.Node.Name,
   145     header: Document.Node_Header, perspective: Text.Perspective, edits: List[Text.Edit])
   145     header: Document.Node_Header, perspective: Text.Perspective, edits: List[Text.Edit])
   403     var finished = false
   403     var finished = false
   404     while (!finished) {
   404     while (!finished) {
   405       receiveWithin(commands_changed_delay.flush_timeout) {
   405       receiveWithin(commands_changed_delay.flush_timeout) {
   406         case TIMEOUT => commands_changed_delay.flush()
   406         case TIMEOUT => commands_changed_delay.flush()
   407 
   407 
   408         case Start(timeout, use_socket, args) if prover.isEmpty =>
   408         case Start(timeout, args) if prover.isEmpty =>
   409           if (phase == Session.Inactive || phase == Session.Failed) {
   409           if (phase == Session.Inactive || phase == Session.Failed) {
   410             phase = Session.Startup
   410             phase = Session.Startup
   411             prover =
   411             prover =
   412               Some(new Isabelle_Process(timeout, use_socket, receiver.invoke _, args)
   412               Some(new Isabelle_Process(timeout, receiver.invoke _, args) with Isar_Document)
   413                 with Isar_Document)
       
   414           }
   413           }
   415 
   414 
   416         case Stop =>
   415         case Stop =>
   417           if (phase == Session.Ready) {
   416           if (phase == Session.Ready) {
   418             global_state.change(_ => Document.State.init)  // FIXME event bus!?
   417             global_state.change(_ => Document.State.init)  // FIXME event bus!?
   467   }
   466   }
   468 
   467 
   469 
   468 
   470   /* actions */
   469   /* actions */
   471 
   470 
   472   def start(timeout: Time, use_socket: Boolean, args: List[String])
   471   def start(timeout: Time, args: List[String])
   473   { session_actor ! Start(timeout, use_socket, args) }
   472   { session_actor ! Start(timeout, args) }
   474 
   473 
   475   def start(args: List[String]) { start (Time.seconds(25), false, args) }
   474   def start(args: List[String]) { start (Time.seconds(25), args) }
   476 
   475 
   477   def stop() { commands_changed_buffer !? Stop; session_actor !? Stop }
   476   def stop() { commands_changed_buffer !? Stop; session_actor !? Stop }
   478 
   477 
   479   def cancel_execution() { session_actor ! Cancel_Execution }
   478   def cancel_execution() { session_actor ! Cancel_Execution }
   480 
   479