summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2009-09-24 12:45:00 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2009-09-24 12:45:00 +0000
commit593d685e4fa50cf087bfc89a208ed2c89d2407c1 (patch)
tree04d0a413a11f9ccd96fc3a347602c8d3a7437f5a /src/library
parentad9103538dec453a5e8a40a750ed3cc664296f68 (diff)
downloadscala-593d685e4fa50cf087bfc89a208ed2c89d2407c1.tar.gz
scala-593d685e4fa50cf087bfc89a208ed2c89d2407c1.tar.bz2
scala-593d685e4fa50cf087bfc89a208ed2c89d2407c1.zip
fixed #2290 and #2325
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/concurrent/ops.scala19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/library/scala/concurrent/ops.scala b/src/library/scala/concurrent/ops.scala
index 67ef093847..3606869350 100644
--- a/src/library/scala/concurrent/ops.scala
+++ b/src/library/scala/concurrent/ops.scala
@@ -20,12 +20,7 @@ import scala.util.control.Exception.allCatch
*/
object ops
{
- // !!! I don't think this should be implicit, but it does need to be
- // made available as a default argument (difficult at present, see spawn.)
- // If it is merely implicit without being specified as a default, then it
- // will not be in scope for callers unless ops._ is first imported.
- implicit val defaultRunner: FutureTaskRunner =
- TaskRunners.threadRunner
+ val defaultRunner: FutureTaskRunner = TaskRunners.threadRunner
/**
* If expression computed successfully return it in <code>Right</code>,
@@ -49,12 +44,7 @@ object ops
*
* @param p the expression to evaluate
*/
- // !!! this should have a signature like:
- // def spawn(p: => Unit)(implicit runner: TaskRunner = defaultRunner): Unit
- // but at present the mixture of by-name argument and default implicit causes a crash.
-
- def spawn(p: => Unit): Unit = spawn(p, defaultRunner)
- def spawn(p: => Unit, runner: TaskRunner): Unit = {
+ def spawn(p: => Unit)(implicit runner: TaskRunner = defaultRunner): Unit = {
runner execute runner.functionAsTask(() => p)
}
@@ -62,10 +52,7 @@ object ops
* @param p ...
* @return ...
*/
- // See spawn above, this should have a signature like
- // def future[A](p: => A)(implicit runner: FutureTaskRunner = defaultRunner): () => A
- def future[A](p: => A): () => A = future[A](p, defaultRunner)
- def future[A](p: => A, runner: FutureTaskRunner): () => A = {
+ def future[A](p: => A)(implicit runner: FutureTaskRunner = defaultRunner): () => A = {
runner.futureAsFunction(runner submit runner.functionAsTask(() => p))
}