Marc Knaup
06/11/2019, 6:44 PMHttpClient
in a background thread on iOS?
The client needs to always be owned by the `Worker`'s thread and be accessible to all executions inside that worker 🤔
I basically need state in a Worker
.Marc Knaup
06/11/2019, 6:47 PM@ThreadLocal
variable for that.
But the documentation isn't very assuring on that:
PLEASE NOTE THAT THIS ANNOTATION MAY GO AWAY IN UPCOMING RELEASES.
olonho
06/11/2019, 6:59 PMMarc Knaup
06/11/2019, 7:01 PM@ThreadLocal
for now.
HttpClient
cannot be frozen as it has mutable state internally.
Using the main thread negatively affects my performance already in the iOS app and I want to get away from that.Marc Knaup
06/11/2019, 8:48 PMHttpClient
instance to a worker.
Illegal transfer state 🤯
Marc Knaup
06/11/2019, 11:19 PMolonho
06/12/2019, 9:07 AMHttpClient
is created with https://github.com/JetBrains/kotlin-native/blob/b49b0be2a12f46e771c7f9e20cb543f6845e170c/runtime/src/main/kotlin/kotlin/native/internal/GC.kt#L29Marc Knaup
06/12/2019, 12:24 PM{ HttpClient(Ios).also { GC.collect() } }