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

Luis Munoz

08/27/2019, 8:26 PM
Say I have a frame handler and it needs to authenticate which I have a suspending function for. Would it better to use the authenticate function from a launch or from a runblocking?
m

Marc Knaup

08/27/2019, 8:29 PM
Well that depends on your handler. Does it work synchronously or asynchronously? The former would needs
runBlocking
the latter
launch
.
l

Luis Munoz

08/27/2019, 8:31 PM
handler is async, can you please explain more why use launch if it is asynchronous?
o

octylFractal

08/27/2019, 8:37 PM
runBlocking
will block until all coroutines started inside complete
m

Marc Knaup

08/27/2019, 8:38 PM
launch
will run the coroutine and run it asynchronously.
handle
in the meantime will return from
launch
immediately,
3 Views