summaryrefslogtreecommitdiff
path: root/src/library/scala/concurrent/Future.scala
diff options
context:
space:
mode:
authoraleksandar <aleksandar@lampmac14.epfl.ch>2012-01-13 19:32:48 +0100
committeraleksandar <aleksandar@lampmac14.epfl.ch>2012-01-13 19:32:48 +0100
commit7993ec04baf28cd12009d15979c2c904afad89d3 (patch)
tree1b35adc699d75cbd585917ad347f24232db491ea /src/library/scala/concurrent/Future.scala
parentf8c3f31f2fbf1544723e4cc3fe4af602dab62372 (diff)
downloadscala-7993ec04baf28cd12009d15979c2c904afad89d3.tar.gz
scala-7993ec04baf28cd12009d15979c2c904afad89d3.tar.bz2
scala-7993ec04baf28cd12009d15979c2c904afad89d3.zip
Migrate akka promises. Changes to some of the interfaces.
Diffstat (limited to 'src/library/scala/concurrent/Future.scala')
-rw-r--r--src/library/scala/concurrent/Future.scala24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/library/scala/concurrent/Future.scala b/src/library/scala/concurrent/Future.scala
index 4002239fc4..e6edaea87a 100644
--- a/src/library/scala/concurrent/Future.scala
+++ b/src/library/scala/concurrent/Future.scala
@@ -29,6 +29,18 @@ import scala.collection.generic.CanBuildFrom
/** The trait that represents futures.
*
+ * Asynchronous computations that yield futures are created with the `future` call:
+ *
+ * {{{
+ * val s = "Hello"
+ * val f: Future[String] = future {
+ * s + " future!"
+ * }
+ * f onSuccess {
+ * case msg => println(msg)
+ * }
+ * }}}
+ *
* @define multipleCallbacks
* Multiple callbacks may be registered; there is no guarantee that they will be
* executed in a particular order.
@@ -37,12 +49,14 @@ import scala.collection.generic.CanBuildFrom
* The future may contain a throwable object and this means that the future failed.
* Futures obtained through combinators have the same exception as the future they were obtained from.
* The following throwable objects are not contained in the future:
- * - Error - errors are not contained within futures
- * - scala.util.control.ControlThrowable - not contained within futures
- * - InterruptedException - not contained within futures
+ * - `Error` - errors are not contained within futures
+ * - `InterruptedException` - not contained within futures
+ * - all `scala.util.control.ControlThrowable` except `NonLocalReturnControl` - not contained within futures
*
* Instead, the future is completed with a ExecutionException with one of the exceptions above
* as the cause.
+ * If a future is failed with a `scala.runtime.NonLocalReturnControl`,
+ * it is completed with a value instead from that throwable instead instead.
*
* @define forComprehensionExamples
* Example:
@@ -146,10 +160,10 @@ self =>
}
this
}
- def await(timeout: Timeout)(implicit canawait: CanAwait): Throwable = {
+ def await(atMost: Duration)(implicit canawait: CanAwait): Throwable = {
var t: Throwable = null
try {
- val res = self.await(timeout)
+ val res = self.await(atMost)
t = noSuchElem(res)
} catch {
case t: Throwable => return t