I have a question is there any difference between ...
# coroutines
I have a question is there any difference between
Copy code
Copy code
launch(start = CoroutineStart.UNDISPATCHED)
? afaiu both will excute job immediatley in the same thread right?
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
oh shit, then this makes a different then
Copy code
mainScope.launch(dispatcher = UNCONFINED) {
 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
Unconfined was changed to use fair ordering no? In that case it would not be the same as UNDISPATCHED?
Prior to the first suspension