https://kotlinlang.org logo
Title
b

bsimmons

09/22/2020, 5:29 PM
Hey all, so I've just started using 1.3.9-native-mt on iOS/native and I'm getting concurrency/freezing exceptions on code that would otherwise run correctly on the JVM. Is there a simple way to fix this code? Can I just force everything to run on the main thread?
l

louiscad

09/22/2020, 8:16 PM
Can you make a small reproducing snippet of your issue?
b

bsimmons

09/23/2020, 12:10 PM
This test works correctly on the JVM. But in iOSX64/native the
results
structure always gets frozen. In the JVM I can manage the shared structure manually using
Mutex
, but native never even gives the chance to do this. (And want to try and avoid complicated solutions like Stately)
l

louiscad

09/23/2020, 12:11 PM
It's because you're using
GlobalScope
. Try just using the existing scope by removing
GlobalScope.
before the
async
calls @bsimmons.
b

bsimmons

09/23/2020, 12:20 PM
Oh sweet, that fixes it. Great thanks.