xii
08/21/2020, 2:55 PMAdam Powell
08/21/2020, 2:57 PMxii
08/21/2020, 3:29 PMxii
08/21/2020, 3:29 PMAdam Powell
08/21/2020, 3:31 PMDeferred
from it? (the .asDeferred
method documented on that page?)xii
08/21/2020, 3:32 PMxii
08/21/2020, 3:32 PMxii
08/21/2020, 3:44 PMxii
08/21/2020, 3:44 PMAdam Powell
08/21/2020, 3:45 PMDeferred
after all. It sounds like you want something more like:
launch {
val result = future.await()
println(result)
}
xii
08/21/2020, 3:46 PMxii
08/21/2020, 3:46 PMxii
08/21/2020, 3:47 PMxii
08/21/2020, 3:48 PMfun parentFunction(){
val test = childFunction.await()
return test + test
}
fun childFunction(){
(outside function that i have no control of).onComplete{ it.toNumber() }
}
Adam Powell
08/21/2020, 4:35 PM.await
extension brings CompletableFuture
usage into this model so that you can expose suspend
functions to the rest of your code and use the structured concurrency model.Adam Powell
08/21/2020, 4:36 PMlaunch {}
or async {}
itxii
08/21/2020, 7:17 PM