Jacob Ras
07/15/2023, 6:39 PMsuspend
fun using async/await (and so it's not the main thread anyway)
I tested this by doing a network call 20 times in a row in a suspend fun, on the IO dispatcher in my commonMain
code:
suspend fun run() {
log("Starting network calls")
repeat(20) { doNetworkCall(); log("Call $it done") }
log("Did network calls")
}
The screen recording attached to this video shows that the UI thread doesn't get blocked.
Now, please help me and correct me if I'm wrong with my two concerns about my test:
1. I see that the SwiftUI spinner keeps spinning, so I assume the main thread is not blocked;
2. This post states that the one thread is "_used for both main and background thread in iOS_", which sounds like the main thread, so it should be an issue even if my test doesn't show it? https://emmanuelkehinde.io/supporting-multithreaded-coroutines-in-a-kotlin-multiplatform-project/
(see thread for video)Jacob Ras
07/15/2023, 6:40 PMrusshwolf
07/15/2023, 10:11 PMThis page describes the features of the legacy memory manager.Everything on there is outdated and shouldn’t be taken as a reference for how things behave currently (unless you’re explicitly using the legacy memory manager for some reason, but you really really shouldn’t be doing that)
Jacob Ras
07/15/2023, 10:35 PMDaniel Seither
07/17/2023, 6:56 AMI see that the SwiftUI spinner keeps spinning, so I assume the main thread is not blockedBe aware that CoreAnimation animations don’t run on the main thread. As far as I remember, a spinner will continue spinning even if the main thread is blocked. That doesn’t mean that the main thread is blocked in your case, but just wanted to say that the spinner is not a good indicator on whether the main thread is blocked or not.