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/53d31e222e13ec2c58ea3508a867ac1f to your computer and use it in GitHub Desktop.
Save pencelab/53d31e222e13ec2c58ea3508a867ac1f to your computer and use it in GitHub Desktop.
runBlocking {
val defIsEven = operator.sumIsEvenAsync()
val defAverage = operator.sumAverageAsync()
val defSquare = operator.sumSquareAsync()
launch {
try {
log("${Operator.OPERATION_IS_EVEN} Result = ${defIsEven.await()}")
} catch (e: Exception) {
log("${Operator.OPERATION_IS_EVEN} Caught: [ $e ]")
} finally {
log("--- NOTHING CONTAINING \"${Operator.OPERATION_IS_EVEN}\" SHOULD APPEAR AFTER THIS LINE ---")
delay(3000)
}
}
launch {
try {
log("${Operator.OPERATION_AVERAGE} Result = ${defAverage.await()}")
} catch (e: Exception) {
log("${Operator.OPERATION_AVERAGE} Caught: [ $e ]")
} finally {
log("--- NOTHING CONTAINING \"${Operator.OPERATION_AVERAGE}\" SHOULD APPEAR AFTER THIS LINE ---")
delay(3000)
}
}
launch {
try {
log("${Operator.OPERATION_SQUARE} Result = ${defSquare.await()}")
} catch (e: Exception) {
log("${Operator.OPERATION_SQUARE} Caught: [ $e ]")
} finally {
log("--- NOTHING CONTAINING \"${Operator.OPERATION_SQUARE}\" 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