https://kotlinlang.org logo
#coroutines
Title
# coroutines
e

elizarov

09/26/2017, 7:35 AM
You can always add
run(UI)
for them just to make sure they are on the right thread (it will not switch if you invoke them from the right thread). Ideally, we should have tooling where you’d annotate your UI functions with
@UI
(or even better — make this annotation inferred by looking at their code and seeing that they use some other UI-thread-only functions) and then it would warn you if you try to use them from the wrong context…. Just an idea.
g

gildor

09/26/2017, 7:45 AM
Yes, it’s quite challenging in case of Android Framework or even your own application. As I know there is no
@MainThread
annotation in Android Framework, only some methods in Support Library But still, tooling support is crucial thing even for such limited usage.
3 Views