So we currently can't pass objects between threads...
# kotlin-native
s
So we currently can't pass objects between threads at all? Is there any way for me to do any sort of threading and get a result in it safely?
g
s
Is this a temporary limitation, or is this limitation expected long-term?
g
Sorry, have no idea, probably Nikolay can help you
s
We are currently considering different approaches to sharing memory between Kotlin “threads”. Stay tuned 🙂
👍 1
o
We consider threads with shared heap an inferior concurrency model, and it seems we are not alone here: https://developer.apple.com/library/content/documentation/General/Conceptual/ConcurrencyProgrammingGuide/ThreadMigration/ThreadMigration.html
👍 3
s
@olonho I can agree with that. So the end goal for Kotlin-native is to have a different threading model then the JVM?
o
Yes, definitevely
s
I had assumed the limitation was due to an incomplete garbage collector or something
where can I read about things like
memScoped
?
o
Not sure where idea of GC incompletness in Native came from
memScoped is pretty straightforward, just a scope collecting all the native allocation
s
I've never worked with C++, so the concurrent sample is tripping me up a little bit. Is it possible using only kotlin to start a thread with some starting data, and then get a result back from the asynchronous computation?
o
idea was to upgrade the sample to Kotlin/Native stdlib API, we just need to decide on API shape
👍 1
s
That'd be nice. So currently there isn't a way through the kotlin stdlib?
o
Right