Skip to content

Instantly share code, notes, and snippets.

@juliuscanute
Created December 8, 2019 20:26
Show Gist options
  • Select an option

  • Save juliuscanute/101fbb4c7c1ddc990f1aaf1b61203eae to your computer and use it in GitHub Desktop.

Select an option

Save juliuscanute/101fbb4c7c1ddc990f1aaf1b61203eae to your computer and use it in GitHub Desktop.
[Run coroutine on launch thread] #coroutine #kotlin #android
fun main() {
GlobalScope.launch(context = Dispatchers.Default) {
println(Thread.currentThread().name)
}
Thread.sleep(50)
}
//DefaultDispatcher-worker-1
fun main() {
GlobalScope.launch(context = Dispatchers.Unconfined) {
println(Thread.currentThread().name)
}
Thread.sleep(50)
}
//main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment