Last active
October 29, 2019 00:47
-
-
Save pencelab/18f347cd0da6a4514b1ab9c6eaa9e668 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
fun main() { | |
log("Start") | |
val myObject = MyObject() | |
runBlocking { | |
log("RunBlocking start") | |
val def = myObject.sumRandomNumbersAsync() | |
def.invokeOnCompletion { exception -> if(exception != null) log("Def On Completion: [ $exception ]") } | |
try { | |
log("RunBlocking Result = ${def.await()}") | |
} catch (e: Exception) { | |
log("RunBlocking Caught: [ $e ]") | |
} finally { | |
log("NOTHING SHOULD APPEAR FROM HERE... { ") | |
delay(3000) | |
log("} ... TO HERE") | |
log("RunBlocking end") | |
} | |
} | |
myObject.release() | |
log("End") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment