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

elizarov

12/28/2016, 12:52 PM
@groostav Please, see the following section that covers conversion of callback-style code into suspension function: https://github.com/Kotlin/kotlin-coroutines/blob/master/kotlin-coroutines-informal.md#wrapping-callbacks TL;DR — you need to invoke
suspendCoroutine
which gets you a
c: Continuation<T>
. Then you install a regular (non-suspending) callback to your
bigCompuitationThatTakesCallback
and you do
c.resume(…)
to resume your coroutine.