1 /*
2  * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3  */
4 
5 // This file was automatically generated from coroutine-context-and-dispatchers.md by Knit tool. Do not edit.
6 package kotlinx.coroutines.guide.exampleContext08
7 
8 import kotlinx.coroutines.*
9 
lognull10 fun log(msg: String) = println("[${Thread.currentThread().name}] $msg")
11 
12 fun main() = runBlocking(CoroutineName("main")) {
13     log("Started main coroutine")
14     // run two background value computations
15     val v1 = async(CoroutineName("v1coroutine")) {
16         delay(500)
17         log("Computing v1")
18         252
19     }
20     val v2 = async(CoroutineName("v2coroutine")) {
21         delay(1000)
22         log("Computing v2")
23         6
24     }
25     log("The answer for v1 / v2 = ${v1.await() / v2.await()}")
26 }
27