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.exampleContext01 7 8 import kotlinx.coroutines.* 9 <lambda>null10fun main() = runBlocking<Unit> { 11 launch { // context of the parent, main runBlocking coroutine 12 println("main runBlocking : I'm working in thread ${Thread.currentThread().name}") 13 } 14 launch(Dispatchers.Unconfined) { // not confined -- will work with main thread 15 println("Unconfined : I'm working in thread ${Thread.currentThread().name}") 16 } 17 launch(Dispatchers.Default) { // will get dispatched to DefaultDispatcher 18 println("Default : I'm working in thread ${Thread.currentThread().name}") 19 } 20 launch(newSingleThreadContext("MyOwnThread")) { // will get its own new thread 21 println("newSingleThreadContext: I'm working in thread ${Thread.currentThread().name}") 22 } 23 } 24