Android issue with Array/Map and Threads

I’m still working on OpenFL 3.6.1 version.
I’ve noticed that in Android devices, not emulated: when two threads going to work on same Array/Map var sometimes app stop working and crash. In specific seems crash is reported when two concorrent thread try to modify same Array/Map.
Anyone experienced something like that? Is there a way to go thread safe?

Thanks in advance.

You could try using a Mutex, Haxe has cpp.vm.Mutex or neko.vm.Mutex.

You acquire the mutex, do your work, then release. Any other threads that use the same mutex sill wait when they try to acquire to wait their turn before getting access. This is helpful when more than one thread needs to write to the same resources.

Reading from two threads is generally okay

Thanks for reply. I’m going to try!