diff options
author | Miles Sabin <miles@milessabin.com> | 2009-10-06 21:33:43 +0000 |
---|---|---|
committer | Miles Sabin <miles@milessabin.com> | 2009-10-06 21:33:43 +0000 |
commit | 94b8abdd93283afc87035b3eb0b1eec157c58534 (patch) | |
tree | 5c400f43b0e80667f8b57ccaebad4747a841ce31 | |
parent | 3826ab49382bac0392eff859d2865e8a3675a011 (diff) | |
download | scala-94b8abdd93283afc87035b3eb0b1eec157c58534.tar.gz scala-94b8abdd93283afc87035b3eb0b1eec157c58534.tar.bz2 scala-94b8abdd93283afc87035b3eb0b1eec157c58534.zip |
Exceptions are part of the protocol between the...
Exceptions are part of the protocol between the interactive compiler and
its clients, so ensure that none are lost.
-rw-r--r-- | src/compiler/scala/tools/nsc/util/WorkScheduler.scala | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/util/WorkScheduler.scala b/src/compiler/scala/tools/nsc/util/WorkScheduler.scala index 392b8b42fc..b4ecbf8a71 100644 --- a/src/compiler/scala/tools/nsc/util/WorkScheduler.scala +++ b/src/compiler/scala/tools/nsc/util/WorkScheduler.scala @@ -8,7 +8,7 @@ class WorkScheduler { type Action = () => Unit private var todo = new Queue[Action] - private var except: Option[Exception] = None + private var except = new Queue[Exception] /** Called from server: block until todo list is nonempty */ def waitForMoreWork() = synchronized { @@ -31,7 +31,14 @@ class WorkScheduler { * Reset to no exception. */ def pollException(): Option[Exception] = synchronized { - val result = except; except = None; result + if (except.isEmpty) + None + else { + val result = Some(except.dequeue()) + if (!except.isEmpty) + postWorkItem { () => } + result + } } /** Called from client: have action executed by server */ @@ -49,7 +56,7 @@ class WorkScheduler { * Require an exception to be thrown on next poll. */ def raise(exc: Exception) = synchronized { - except = Some(exc) + except enqueue exc postWorkItem { () => } } } |