diff options
author | Martin Odersky <odersky@gmail.com> | 2012-07-25 15:58:45 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2012-07-27 17:04:36 +0200 |
commit | e896c0ab2d36740207f91086262e9feb4fc1c32d (patch) | |
tree | a5bd5892b7a0cdcd1f5353757af640f2da7919b9 /src/compiler/scala/tools/nsc/util/WorkScheduler.scala | |
parent | 50903959efc2dcc4093f3d7c0b4b9b9def51cc04 (diff) | |
download | scala-e896c0ab2d36740207f91086262e9feb4fc1c32d.tar.gz scala-e896c0ab2d36740207f91086262e9feb4fc1c32d.tar.bz2 scala-e896c0ab2d36740207f91086262e9feb4fc1c32d.zip |
Adds method askForResponse
Adds method askForResponse which returns a response immediately instead of waiting for a result. That way, one can wait for an ask's result using a timeout.
Diffstat (limited to 'src/compiler/scala/tools/nsc/util/WorkScheduler.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/util/WorkScheduler.scala | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/util/WorkScheduler.scala b/src/compiler/scala/tools/nsc/util/WorkScheduler.scala index 8c037cbda5..b1f4696d3e 100644 --- a/src/compiler/scala/tools/nsc/util/WorkScheduler.scala +++ b/src/compiler/scala/tools/nsc/util/WorkScheduler.scala @@ -54,6 +54,11 @@ class WorkScheduler { /** Called from client: have interrupt executed by server and return result */ def doQuickly[A](op: () => A): A = { + val ir = askDoQuickly(op) + ir.getResult() + } + + def askDoQuickly[A](op: () => A): InterruptReq { type R = A } = { val ir = new InterruptReq { type R = A val todo = op @@ -62,7 +67,7 @@ class WorkScheduler { interruptReqs enqueue ir notify() } - ir.getResult() + ir } /** Called from client: have action executed by server */ |