Currently, coroutines are supported only for main ...
# kotlin-native
y
Currently, coroutines are supported only for main thread. So, http call with coroutines does not block main thread. But, in iOS, main queue (which manages main thread) is a serial queue. This means one processing will be performed after other processing queued previously have done. This is a problem in case of these. - calling many http requesting at once. (should be done concurrently.) - calling http request after heavy processing like image processing.
y
No, but it seems request is performed in main queue, too. It means processing are performed in serial.
<https://github.com/JetBrains/kotlin-native/blob/f68f7028b10ce6f8cd195faaee2c78fd8432ddf1/samples/objc/src/objcMain/kotlin/Window.kt#L150>
o
sure not, first lambda parsing JSON is executed in async queue, only second one one which sets UI element is executed in UI thread
y
Oh, sorry 🙏
I forgot to tell you. I’m using ktor and I want to share ktor http client codes. But, It uses coroutines worked only with main thread.
so,
<https://kotlinlang.slack.com/archives/C3SGXARS6/p1542767647494700>
o
yeah, making ktor to use async queues is planned, but not done yet. But we’re working on it.
y
Very nice 👍 I’m looking forward to it