# HG changeset patch # User wenzelm # Date 1251831957 -7200 # Node ID 3c0a8bece8b837eab4e824a4f4619d0579cce689 # Parent f28c014bcbe3cfc101011e1991c0ff44fa9095c0 Isabelle_Process: receiver as Actor -- requires Scheduler.shutdown in the end; handle_message: plain function Isabelle_Process.parse_message avoids race on process variable in the first place; diff -r f28c014bcbe3 -r 3c0a8bece8b8 src/Tools/jEdit/src/jedit/Plugin.scala --- a/src/Tools/jEdit/src/jedit/Plugin.scala Tue Sep 01 15:37:05 2009 +0200 +++ b/src/Tools/jEdit/src/jedit/Plugin.scala Tue Sep 01 21:05:57 2009 +0200 @@ -163,6 +163,7 @@ // TODO: proper cleanup Isabelle.system = null Isabelle.plugin = null + scala.actors.Scheduler.shutdown() } } diff -r f28c014bcbe3 -r 3c0a8bece8b8 src/Tools/jEdit/src/prover/Prover.scala --- a/src/Tools/jEdit/src/prover/Prover.scala Tue Sep 01 15:37:05 2009 +0200 +++ b/src/Tools/jEdit/src/prover/Prover.scala Tue Sep 01 21:05:57 2009 +0200 @@ -27,15 +27,18 @@ } class Prover(isabelle_system: Isabelle_System, logic: String, change_receiver: Actor) -extends Actor + extends Actor { /* prover process */ private val process = { - val results = new EventBus[Isabelle_Process.Result] + handle_result - results.logger = Log.log(Log.ERROR, null, _) - new Isabelle_Process(isabelle_system, results, "-m", "xsymbols", logic) with Isar_Document + val receiver = new Actor { + def act() = { + loop { react { case res: Isabelle_Process.Result => handle_result(res) } } + } + }.start + new Isabelle_Process(isabelle_system, receiver, "-m", "xsymbols", logic) with Isar_Document } def stop() { process.kill } @@ -103,13 +106,7 @@ else None } output_info.event(result) - val message = - try{process.parse_message(result)} - /* handle_results can be called before val process is initialized */ - catch { - case e: NullPointerException => - System.err.println("NPE; did not handle_result: " + result) - } + val message = Isabelle_Process.parse_message(isabelle_system, result) if (state.isDefined) state.get ! message else result.kind match {