<@U3SK5B492> Something that's still not clear to m...
# kotlin-native
s
@olonho Something that's still not clear to me. You kind of reference this on the 2nd to last slide on your presentation. If I create a library in Kotlin/native and use it in Swift / ObjC. Let's say the library has a ServerApi class to call and access the server endpoints. Am I allowed to share the ServerApi object instance between threads as I would normally in Swift / ObjC?
o
it depends on mutability of the
ServerApi
object, if it's frozen (and maybe just encapsulate mutable state in an Objective-C object) then yes. See https://github.com/JetBrains/kotlin-native/pull/2177/files where I sketeched solution for the similar problem.
s
I see. Freezing the
HttpDelegate
will freeze the references to
NSOperationQueue
and
NSMutableData
, and because those aren't Kotlin objects, they can still have new operations queued, and data added?
o
yeah, although in the case of NSMutableData it's not strictly required that matching Kotlin object is frozen, it could be passed with the URL
h
You should probably emphasize it here
<https://github.com/JetBrains/kotlin-native/blob/master/CONCURRENCY.md#transfer>
. Up until now I too though that freezing applies to everything, not just K/N objects.
y
Where did you see these slides? Is there a link?