https://kotlinlang.org logo
Title
b

Big Chungus

01/12/2020, 11:25 AM
How can I mutate a
MutableSet
from different threads with coroutines on native without getting the
InvalidMutablityException
?
m

Mikołaj Kąkol

01/12/2020, 11:36 AM
if atomicfu doesn't help, maybe you should rethink an architecture, maybe you could pass a funtion that will update list properly on another thread
d

Dominaezzz

01/12/2020, 11:38 AM
There's also https://github.com/touchlab/Stately if all esle fails.
b

Big Chungus

01/12/2020, 12:16 PM
@Mikołaj Kąkol what's
atomicfu
?
m

Mikołaj Kąkol

01/12/2020, 12:16 PM
g

gildor

01/12/2020, 3:25 PM
Protect it with Mutex or use actor
atomicfu is also an option, but it's a low level primitive and requires more careful usage