When doSomething is a suspend fun, then there is a convention that it does not block the caller thread. If doSomething performs some kind of non-blocking (asynchronous) IO and it is some short computation, then this properly follows automatically. If doSomething performs blocking IO or some long-running computation, then it is the responsibility of doSomething to ensure proper context using withContext(ctx) { ... }, where ctx is Dispatchers.IO for a case of blocking IO or Dispatchers.Default for a long-running computation.

Written by

Project Lead for the Kotlin Programming Language @JetBrains

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store