blob: 927567b329c9003af88818082daabf59097c1817 [file] [log] [blame]
// This file was automatically generated from coroutines-guide.md by Knit tool. Do not edit.
package guide.compose.example03
import kotlinx.coroutines.experimental.*
import kotlin.system.measureTimeMillis
suspend fun doSomethingUsefulOne(): Int {
delay(1000L) // pretend we are doing something useful here
return 13
}
suspend fun doSomethingUsefulTwo(): Int {
delay(1000L) // pretend we are doing something useful here, too
return 29
}
fun main(args: Array<String>) = runBlocking<Unit> {
val time = measureTimeMillis {
val one = lazyDefer(CommonPool) { doSomethingUsefulOne() }
val two = lazyDefer(CommonPool) { doSomethingUsefulTwo() }
println("The answer is ${one.await() + two.await()}")
}
println("Completed in $time ms")
}