Is this a bug? ``` fun main(args: Array<String&...
# coroutines
r
Is this a bug?
Copy code
fun main(args: Array<String>) = runBlocking {
  fun log(msg: String) = println("[${Thread.currentThread().name}] $msg")

  newSingleThreadContext("SINGLE-THREAD").use {
    launch(it) {
      log("Running in single-thread context.")
      withContext(CommonPool) {
        log("Running in CommonPool context.")
      }
      log("Should be back to running in single-thread context?")
    }
  }.join()
}
prints:
Copy code
[SINGLE-THREAD @coroutine#2] Running in single-thread context.
[ForkJoinPool.commonPool-worker-25 @coroutine#2] Running in CommonPool context.
[kotlinx.coroutines.DefaultExecutor @coroutine#2] Should be back to running in single-thread context?