https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

Matteo Wohlrapp

09/16/2020, 6:34 AM
Does anyone know if Kotlin suspend functions actually suspend on iOS and if so, how is it implemented on iOS?
l

louiscad

09/16/2020, 7:18 AM
About the same way as on the JVM. It's callbacks chains under the hood.
m

Matteo Wohlrapp

09/16/2020, 8:42 AM
Thanks!
@louiscad sorry to bother you again but I couldn`t find more information about it in the documentation. Are they actually suspending or just blocking the thread?
l

louiscad

09/17/2020, 7:09 AM
They are suspending, which under the hood, is waiting for a callback.
You have access to
Continuation
in Kotlin/Native as well @Matteo Wohlrapp
suspendCancellableCoroutine
and other suspend primitives wouldn't be able to work just like on JVM and JS without that.
m

Matteo Wohlrapp

09/17/2020, 7:13 AM
Ok, thanks a lot 😁