Skip to content

Instantly share code, notes, and snippets.

@zach-klippenstein
Created September 17, 2018 07:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zach-klippenstein/8b64b2bc99fcbdaa0849b562c43be716 to your computer and use it in GitHub Desktop.
Save zach-klippenstein/8b64b2bc99fcbdaa0849b562c43be716 to your computer and use it in GitHub Desktop.
class CoroutineNamesTest {
@Test fun coroutineNames() {
runBlocking(CoroutineName("parent")) {
println("parent: $coroutineContext")
launch {
println("unnamed child: $coroutineContext")
}
launch(CoroutineName("named child")) {
println("named child: $coroutineContext")
}
}
}
}
parent: [CoroutineName(parent), CoroutineId(1), "parent#1":BlockingCoroutine{Active}@47d384ee, BlockingEventLoop@2d6a9952]
unnamed child: [CoroutineName(parent), CoroutineId(2), "parent#2":StandaloneCoroutine{Active}@2aafb23c, BlockingEventLoop@2d6a9952]
named child: [CoroutineName(named child), CoroutineId(3), "named child#3":StandaloneCoroutine{Active}@2eee9593, BlockingEventLoop@2d6a9952]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment