Skip to content

Instantly share code, notes, and snippets.

@jeziellago
Created August 13, 2018 00:22
Show Gist options
  • Save jeziellago/9f89d7d74ad0c5c47d2eef75bae40d7c to your computer and use it in GitHub Desktop.
Save jeziellago/9f89d7d74ad0c5c47d2eef75bae40d7c to your computer and use it in GitHub Desktop.
fun loadTask() = launch(UI) { // executa na main thread
// executa em uma thread separada
val result1 = withContext(CommonPool) { // work! }
// executa na mesma thread
val result2 = withContext(Unconfined) { // work! }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment