Hi. guys! I’m stuck with an issue in coroutines wi...
# coroutines
t
Hi. guys! I’m stuck with an issue in coroutines with switching back to the main thread after I updated - the kotlin version from ‘1.2.70’ to ‘1.3.20’ - the gradle plugin versino “3.2.1” to “3.3.1" I’m still using coroutines experimental lib version 0.19 : org.jetbrains.kotlinxkotlinx coroutines core0.19 org.jetbrains.kotlinxkotlinx coroutines android0.19 The output is of that code is: I/System.out: Thread launchUI coroutine main I/System.out: Thread inside coroutine is ForkJoinPool.commonPool-worker-0 I/System.out: Thread after coroutine join ForkJoinPool.commonPool-worker-0 Also, I see the same with not switching to Main thread when use actor with default context(CommonPool) and then via the channel notify about updates and in consumeEach the thread didn’t change to main. Does anybody having such troubles?
o
I wouldn't use the experimental lib -- any issues you have may have been solved in the released variant
Try again with non-experimental and see if it still has the same problem
t
The code changes in updating to release variant is quite huge. So do you see no chances to make it working as it was with kotlin 1.2.70 and gradle 3.2.1 ?
o
honestly, I'm not sure why it would break
but likely the changes introduced by 1.3 for the underlying language support of coroutines broke it, and that's not something that's going to be fixed easily, if at all
s
I strongly suggest upgrading to the non-experimental coroutines as well. You used the experimental version of it and with this you took the risk of needing to handle breaking changes in the future. I fear that has now happened to you.
d
Intellij has an update procedure right? That updates the code
u
You might still need to prepend your
launch
etc. with
GlobalScope.
to emulate the old, not-structured concurrency model
Unless of course, you want to implement and benefit form structured concurrency right away