SHARE
TWEET

Untitled

a guest Jan 24th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fun main(args: Array<String>) = runBlocking<Unit> {
  2.     launch(Dispatchers.Unconfined) {
  3.         // not confined -- will work with main thread
  4.         println("Unconfined      : I'm working in thread ${Thread.currentThread().name}")
  5.         delay(500)
  6.         println("Unconfined      : After delay in thread ${Thread.currentThread().name}")
  7.     }
  8.     launch {
  9.         // context of the parent, main runBlocking coroutine
  10.         println("main runBlocking: I'm working in thread ${Thread.currentThread().name}")
  11.         delay(1000)
  12.         println("main runBlocking: After delay in thread ${Thread.currentThread().name}")
  13.     }
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top