Colton Idle
12/10/2019, 8:14 AMawait()
a coroutine? I thought I would be able to just define my val result = myRetrofitSuspendingCall
and call await()
on it. It seems like I need to wrap it in an async{}
block before I do, but it seems a little counterintuitive. (I'm still new at coroutines)? Is this async block needed because coroutines themselves still read like synchronous code?octylFractal
12/10/2019, 8:15 AMasync
communicates that you want to return a valuejoin
on the Job insteadColton Idle
12/10/2019, 8:23 AMval work1 = async { getThingsDone(43) }
val work2 = async { getThingsDoneAgain(123) }
val result = computeResult(work1.await(), work2.await())
Or should I use join
?
Also @octylFractal thanks for the help yesterday as well. 😄octylFractal
12/10/2019, 8:25 AMColton Idle
12/10/2019, 8:26 AMoctylFractal
12/10/2019, 8:29 AMDeferred<T>
you await
, when you have a Job
you join
Colton Idle
12/10/2019, 8:30 AM