// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) package e import kotlinx.coroutines.* suspend fun demo(): Int { println("before") delay(5000) println("after") return 42 } fun test() { runBlocking { println(System.currentTimeMillis()) var f = async { demo() } println(System.currentTimeMillis()) delay(1000) println(System.currentTimeMillis()) var v = f.await() println(System.currentTimeMillis()) } } fun main(args: Array) { test() }