Skip to content

Commit

Permalink
Remove useless Future.await extension method
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Dec 5, 2024
1 parent ce00dcf commit eb9baec
Showing 1 changed file with 0 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,6 @@ suspend fun <T> awaitBlocking(block: () -> T): T {
}
}

/**
* Awaits the completion of a future without blocking the event loop.
*/
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
@Deprecated("As of 4.5, deprecated in favor of coAwait()", ReplaceWith("coAwait()"))
suspend fun <T> Future<T>.await(): T = when {
succeeded() -> result()
failed() -> throw cause()
else -> suspendCancellableCoroutine { cont: CancellableContinuation<T> ->
onComplete { asyncResult ->
if (asyncResult.succeeded()) cont.resume(asyncResult.result() as T)
else cont.resumeWithException(asyncResult.cause())
}
}
}

/**
* Awaits the completion of a future without blocking the event loop.
*/
Expand Down

0 comments on commit eb9baec

Please sign in to comment.