Created
March 21, 2019 14:38
-
-
Save MovileGente/83be227ae98404385e7483385577ed77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
suspend fun <T> CompletableFuture<T>.await(): T = | |
suspendCoroutine<T> { cont: Continuation<T> -> | |
whenComplete { result, exception -> | |
if (exception == null) { | |
cont.resume(result) | |
} else { | |
cont.resumeWithException(exception) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment