Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pencelab/ec4e9b92e01173f8d6a3c5ee07f93dec to your computer and use it in GitHub Desktop.
Save pencelab/ec4e9b92e01173f8d6a3c5ee07f93dec to your computer and use it in GitHub Desktop.
runBlocking {
val defIsEven = operator.sumIsEvenAsync()
val defAverage = operator.sumAverageAsync()
launch {
try {
log("Operation [Is Even] Result = ${defIsEven.await()}")
} catch (e: Exception) {
log("Operation [Is Even] Caught: [ $e ]")
} finally {
log("--- NOTHING CONTAINING \"Operation [Is Even]\" SHOULD APPEAR AFTER THIS LINE ---")
delay(3000)
}
}
launch {
try {
log("Operation [Average] Result = ${defAverage.await()}")
} catch (e: Exception) {
log("Operation [Average] Caught: [ $e ]")
} finally {
log("--- NOTHING CONTAINING \"Operation [Average]\" SHOULD APPEAR AFTER THIS LINE ---")
delay(3000)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment