src/Pure/Tools/server.scala
changeset 73133 497e11537d48
parent 73132 479668d61cef
child 73135 76bdfde8a579
equal deleted inserted replaced
73132:479668d61cef 73133:497e11537d48
   148         }
   148         }
   149       }
   149       }
   150 
   150 
   151     def start { thread }
   151     def start { thread }
   152     def join { thread.join }
   152     def join { thread.join }
       
   153     def stop { socket.close; join }
   153   }
   154   }
   154 
   155 
   155 
   156 
   156   /* socket connection */
   157   /* socket connection */
   157 
   158 
   184       catch { case _: IOException => false }
   185       catch { case _: IOException => false }
   185 
   186 
   186     def read_message(): Option[String] =
   187     def read_message(): Option[String] =
   187       try { Byte_Message.read_line_message(in).map(_.text) }
   188       try { Byte_Message.read_line_message(in).map(_.text) }
   188       catch { case _: IOException => None }
   189       catch { case _: IOException => None }
       
   190 
       
   191     def await_close(): Unit =
       
   192       try { Byte_Message.read(in, 1) }
       
   193       catch { case _: IOException => }
   189 
   194 
   190     def write_message(msg: String): Unit =
   195     def write_message(msg: String): Unit =
   191       out_lock.synchronized { Byte_Message.write_line_message(out, Bytes(UTF8.bytes(msg))) }
   196       out_lock.synchronized { Byte_Message.write_line_message(out, Bytes(UTF8.bytes(msg))) }
   192 
   197 
   193     def reply(r: Reply.Value, arg: Any)
   198     def reply(r: Reply.Value, arg: Any)