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

alex.tavella

08/17/2018, 11:52 AM
No, right?
m

Martin Devillers

08/17/2018, 11:54 AM
It’s a way to run some code on the UI thread, although not the most idiomatic way
a

alex.tavella

08/17/2018, 11:59 AM
Ur right, but in our case it's already on main thread...
m

Martin Devillers

08/17/2018, 12:01 PM
Then it will post it on the looper, so it’ll be added to the “queue” of the main thread, which is sometimes a desired behavior (rather than executing the code immediately). Still, it’s not very idiomatic, and usually it’s a hack.
👍 1
b

bj0

08/17/2018, 1:48 PM
or you wan it to run concurrently
u

uli

08/17/2018, 3:24 PM
@bj0 concurrent to what?
b

bj0

08/17/2018, 3:31 PM
to what comes after
launch
u

uli

08/17/2018, 3:32 PM
... which will run on the main thread as well. Even with coroutines you don't get concurrency on a single thread
b

bj0

08/17/2018, 5:42 PM
concurrent isn't the same as parallel
u

uli

08/17/2018, 6:24 PM
So what kind of concurrency do you mean?
u

uli

08/17/2018, 9:16 PM
Thanks Brian. I am aware of the difference. I would just say that executing some blocking code and queueing another blocking piece of code to be executed after the first code finished does not really qualify as 'at once'. But that gets academic and possibly boreing for every body else. Thanks again for sharing the intention behind your comment.
b

bj0

08/17/2018, 10:00 PM
ah I didn't see him say it was blocking, I just saw him ask why someone would use the snippet he posted
2 Views