?
afaiu both will excute job immediatley in the same thread right?
e
elizarov
01/27/2020, 1:57 PM
Yes. However, after the first suspension they will behave differently. The first one will continue to be unconfined (will resume in an arbitrary thread driven by the suspending function that was used), while the second one will resume in the thread that is defined by its dispatcher.
👍 2
m
mingkangpan
01/27/2020, 2:11 PM
oh shit, then this makes a different then
Copy code
mainScope.launch(dispatcher = UNCONFINED) {
ui.update()
val result = retrofit.fetchResult() //<- retrofit uses non UI thread by default
ui.updateResult() //<- this would beexecuted on non UI thread and eventually lead to crash
}
👍 1
d
Dico
01/27/2020, 6:01 PM
Unconfined was changed to use fair ordering no? In that case it would not be the same as UNDISPATCHED?