Added Future[T] as return type for await and awaitBlocking

This commit is contained in:
Viktor Klang 2010-04-25 18:07:27 +02:00
parent 4bc833acae
commit 2b9f7be1a7

View file

@ -71,8 +71,8 @@ object Futures {
} }
sealed trait Future[T] { sealed trait Future[T] {
def await def await : Future[T]
def awaitBlocking def awaitBlocking : Future[T]
def isCompleted: Boolean def isCompleted: Boolean
def isExpired: Boolean def isExpired: Boolean
def timeoutInNanos: Long def timeoutInNanos: Long
@ -111,6 +111,7 @@ class DefaultCompletableFuture[T](timeout: Long) extends CompletableFuture[T] {
wait = wait - (currentTimeInNanos - start) wait = wait - (currentTimeInNanos - start)
} }
} }
this
} finally { } finally {
_lock.unlock _lock.unlock
} }
@ -120,6 +121,7 @@ class DefaultCompletableFuture[T](timeout: Long) extends CompletableFuture[T] {
while (!_completed) { while (!_completed) {
_signal.await _signal.await
} }
this
} finally { } finally {
_lock.unlock _lock.unlock
} }