summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/util/InterruptReq.scala13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/util/InterruptReq.scala b/src/compiler/scala/tools/nsc/util/InterruptReq.scala
index aa7804acbe..e7c05beb65 100644
--- a/src/compiler/scala/tools/nsc/util/InterruptReq.scala
+++ b/src/compiler/scala/tools/nsc/util/InterruptReq.scala
@@ -12,17 +12,24 @@ abstract class InterruptReq {
protected val todo: () => R
/** The result provided */
- private var result: Option[R] = None
+ private var result: Option[Either[R, Throwable]] = None
/** To be called from interrupted server to execute demanded task */
def execute(): Unit = synchronized {
- result = Some(todo())
+ try {
+ result = Some(Left(todo()))
+ } catch {
+ case t => result = Some(Right(t))
+ }
notify()
}
/** To be called from interrupting client to get result fo interrupt */
def getResult(): R = synchronized {
while (result.isEmpty) wait()
- result.get
+ result.get match {
+ case Left(res) => res
+ case Right(t) => throw t
+ }
}
}