Viktor Qvarfordt
05/16/2019, 10:24 PMsuspend
, ie. suspend fun main() { ... }
? Is it equivalent to having fun main() = runBlocking { ... }
or something else?gildor
05/16/2019, 10:26 PMViktor Qvarfordt
05/16/2019, 10:27 PMelizarov
05/16/2019, 10:39 PMrunBlocking
also confined your coroutines to the main thread (install its own distacher), but the code in suspend main
executes in a default dispatcher. Only really matters when yo go coroutineScope { ... }
and start launching coroutines from there.simon.vergauwen
05/16/2019, 10:58 PMlouiscad
05/17/2019, 12:06 AMrunBlocking
is not the default dispatcher at all, but uses the (single) thread it blocks as the dispatcher. Very different from using suspend fun main()
and letting it use the default dispatcher (quite correctly named Dispatchers.Default
).simon.vergauwen
05/17/2019, 12:12 AMsuspend fun main()
start on main?elizarov
05/17/2019, 5:22 AMrunBlocking